src/Controller/TreeCollector.php
private function addParentFilter(ConfigInterface $config, ModelInterface $parentModel)
    {
        $environment     = $this->getEnvironment();
        $definition      = $environment->getDataDefinition();
        $basicDefinition = $definition->getBasicDefinition();

        if (!$basicDefinition->getParentDataProvider()) {
            return;
        }

        if ($basicDefinition->getParentDataProvider() !== $parentModel->getProviderName()) {
            throw new \RuntimeException(
                \sprintf(
                    'Parent provider mismatch: %s vs. %s',
                    $basicDefinition->getParentDataProvider(),
                    $parentModel->getProviderName()
                )
            );
        }

        // Apply parent filtering, do this only for root elements.
        if ($parentCondition = $definition->getModelRelationshipDefinition()->getChildCondition(
            $basicDefinition->getParentDataProvider(),
            $basicDefinition->getRootDataProvider()
        )) {
            $baseFilter = $config->getFilter();
            $filter     = $parentCondition->getFilter($parentModel);

            if ($baseFilter) {
                $filter = \array_merge($baseFilter, $filter);
            }

            $config->setFilter($filter);
        }
    }
private function addParentFilter(ConfigInterface $config, ModelInterface $parentModel)
    {
        $environment     = $this->getEnvironment();
        $definition      = $environment->getDataDefinition();
        $basicDefinition = $definition->getBasicDefinition();

        if (!$basicDefinition->getParentDataProvider()) {
            return;
        }

        if ($basicDefinition->getParentDataProvider() !== $parentModel->getProviderName()) {
            throw new \RuntimeException(
                \sprintf(
                    'Parent provider mismatch: %s vs. %s',
                    $basicDefinition->getParentDataProvider(),
                    $parentModel->getProviderName()
                )
            );
        }

        // Apply parent filtering, do this only for root elements.
        if ($parentCondition = $definition->getModelRelationshipDefinition()->getChildCondition(
            $basicDefinition->getParentDataProvider(),
            $basicDefinition->getRootDataProvider()
        )) {
            $baseFilter = $config->getFilter();
            $filter     = $parentCondition->getFilter($parentModel);

            if ($baseFilter) {
                $filter = \array_merge($baseFilter, $filter);
            }

            $config->setFilter($filter);
        }
    }
private function addParentFilter ( ConfigInterface $ config , ModelInterface $ parentModel ) { $ environment = $ this -> getEnvironment ( ) ; $ definition = $ environment -> getDataDefinition ( ) ; $ basicDefinition = $ definition -> getBasicDefinition ( ) ; if ( ! $ basicDefinition -> getParentDataProvider ( ) ) { return ; } if ( $ basicDefinition -> getParentDataProvider ( ) !== $ parentModel -> getProviderName ( ) ) { throw new \ RuntimeException ( \ sprintf ( 'Parent provider mismatch: %s vs. %s' , $ basicDefinition -> getParentDataProvider ( ) , $ parentModel -> getProviderName ( ) ) ) ; } // Apply parent filtering, do this only for root elements. if ( $ parentCondition = $ definition -> getModelRelationshipDefinition ( ) -> getChildCondition ( $ basicDefinition -> getParentDataProvider ( ) , $ basicDefinition -> getRootDataProvider ( ) ) ) { $ baseFilter = $ config -> getFilter ( ) ; $ filter = $ parentCondition -> getFilter ( $ parentModel ) ; if ( $ baseFilter ) { $ filter = \ array_merge ( $ baseFilter , $ filter ) ; } $ config -> setFilter ( $ filter ) ; } }
Add the parent filtering to the given data config if any defined.

@param ConfigInterface $config      The data config.
@param ModelInterface  $parentModel The parent model.

@return void

@throws \RuntimeException When the parent provider does not match.
Add the parent filtering to the given data config if any defined .