Neos\Eel\FlowQuery\Operations\Object\ChildrenOperation::evaluatePropertyNameFilter PHP Метод

evaluatePropertyNameFilter() защищенный Метод

Evaluate the property name filter by traversing to the child object. We only support nested objects right now
protected evaluatePropertyNameFilter ( FlowQuery $query, string $propertyNameFilter ) : void
$query Neos\Eel\FlowQuery\FlowQuery
$propertyNameFilter string
Результат void
    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);
    }