protected function evaluatePropertyNameFilter(FlowQuery $query, $propertyNameFilter)
{
$resultObjects = [];
$resultObjectHashes = [];
foreach ($query->getContext() as $element) {
$subProperty = ObjectAccess::getPropertyPath($element, $propertyNameFilter);
if (is_object($subProperty) || is_array($subProperty)) {
if (is_array($subProperty) || $subProperty instanceof \Traversable) {
foreach ($subProperty as $childElement) {
if (!isset($resultObjectHashes[spl_object_hash($childElement)])) {
$resultObjectHashes[spl_object_hash($childElement)] = true;
$resultObjects[] = $childElement;
}
}
} elseif (!isset($resultObjectHashes[spl_object_hash($subProperty)])) {
$resultObjectHashes[spl_object_hash($subProperty)] = true;
$resultObjects[] = $subProperty;
}
}
}
$query->setContext($resultObjects);
}