src/Controller/ModelCollector.php
private function searchParentOfInParentedMode(ModelInterface $model)
    {
        if ($this->defaultProviderName !== $model->getProviderName()) {
            throw new DcGeneralInvalidArgumentException(
                'Model originates from ' . $model->getProviderName() .
                ' but is expected to be from ' . $this->defaultProviderName .
                ' can not determine parent.'
            );
        }

        $condition = $this->relationships->getChildCondition($this->parentProviderName, $this->defaultProviderName);
        // This is pretty expensive, we fetch all models from the parent provider here.
        // This can be much faster by using the inverse condition if present.
        foreach ($this->parentProvider->fetchAll($this->parentProvider->getEmptyConfig()) as $candidate) {
            if ($condition->matches($candidate, $model)) {
                return $candidate;
            }
        }

        return null;
    }
private function searchParentOfInParentedMode(ModelInterface $model)
    {
        if ($this->defaultProviderName !== $model->getProviderName()) {
            throw new DcGeneralInvalidArgumentException(
                'Model originates from ' . $model->getProviderName() .
                ' but is expected to be from ' . $this->defaultProviderName .
                ' can not determine parent.'
            );
        }

        $condition = $this->relationships->getChildCondition($this->parentProviderName, $this->defaultProviderName);
        // This is pretty expensive, we fetch all models from the parent provider here.
        // This can be much faster by using the inverse condition if present.
        foreach ($this->parentProvider->fetchAll($this->parentProvider->getEmptyConfig()) as $candidate) {
            if ($condition->matches($candidate, $model)) {
                return $candidate;
            }
        }

        return null;
    }
private function searchParentOfInParentedMode ( ModelInterface $ model ) { if ( $ this -> defaultProviderName !== $ model -> getProviderName ( ) ) { throw new DcGeneralInvalidArgumentException ( 'Model originates from ' . $ model -> getProviderName ( ) . ' but is expected to be from ' . $ this -> defaultProviderName . ' can not determine parent.' ) ; } $ condition = $ this -> relationships -> getChildCondition ( $ this -> parentProviderName , $ this -> defaultProviderName ) ; // This is pretty expensive, we fetch all models from the parent provider here. // This can be much faster by using the inverse condition if present. foreach ( $ this -> parentProvider -> fetchAll ( $ this -> parentProvider -> getEmptyConfig ( ) ) as $ candidate ) { if ( $ condition -> matches ( $ candidate , $ model ) ) { return $ candidate ; } } return null ; }
Search the parent of a model in parented mode.

@param ModelInterface $model The model to search the parent of.

@return ModelInterface|null

@throws DcGeneralInvalidArgumentException When the model does not originate from the child provider.
Search the parent of a model in parented mode .