src/Contao/View/Contao2BackendView/TreePicker.php
private function parentsOf($model, &$parents)
    {
        $environment    = $this->getEnvironment();
        $dataDefinition = $environment->getDataDefinition();
        $collector      = new ModelCollector($this->getEnvironment());
        $relationships  = new RelationshipManager(
            $dataDefinition->getModelRelationshipDefinition(),
            $dataDefinition->getBasicDefinition()->getMode()
        );

        if (!$relationships->isRoot($model)) {
            $parent = $collector->searchParentOf($model);
            if (!isset($parents[$model->getProviderName()][$parent->getId()])) {
                $this->parentsOf($parent, $parents);
            }
        }

        $parents[$model->getProviderName()][$model->getId()] = 1;
    }
private function parentsOf($model, &$parents)
    {
        $environment    = $this->getEnvironment();
        $dataDefinition = $environment->getDataDefinition();
        $collector      = new ModelCollector($this->getEnvironment());
        $relationships  = new RelationshipManager(
            $dataDefinition->getModelRelationshipDefinition(),
            $dataDefinition->getBasicDefinition()->getMode()
        );

        if (!$relationships->isRoot($model)) {
            $parent = $collector->searchParentOf($model);
            if (!isset($parents[$model->getProviderName()][$parent->getId()])) {
                $this->parentsOf($parent, $parents);
            }
        }

        $parents[$model->getProviderName()][$model->getId()] = 1;
    }
private function parentsOf ( $ model , & $ parents ) { $ environment = $ this -> getEnvironment ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; $ collector = new ModelCollector ( $ this -> getEnvironment ( ) ) ; $ relationships = new RelationshipManager ( $ dataDefinition -> getModelRelationshipDefinition ( ) , $ dataDefinition -> getBasicDefinition ( ) -> getMode ( ) ) ; if ( ! $ relationships -> isRoot ( $ model ) ) { $ parent = $ collector -> searchParentOf ( $ model ) ; if ( ! isset ( $ parents [ $ model -> getProviderName ( ) ] [ $ parent -> getId ( ) ] ) ) { $ this -> parentsOf ( $ parent , $ parents ) ; } } $ parents [ $ model -> getProviderName ( ) ] [ $ model -> getId ( ) ] = 1 ; }
Fetch all parents of the passed model.

@param ModelInterface $model   The model.
@param string[]       $parents The ids of all detected parents so far.

@return void
Fetch all parents of the passed model .