src/Controller/RelationshipManager.php
public function setParent(ModelInterface $childModel, ModelInterface $parentModel)
    {
        $condition = $this->relationships->getChildCondition(
            $parentModel->getProviderName(),
            $childModel->getProviderName()
        );
        if (!$condition instanceof ParentChildConditionInterface) {
            throw new DcGeneralRuntimeException(
                'No condition defined from ' . $parentModel->getProviderName() . ' to ' . $childModel->getProviderName()
            );
        }

        $condition->applyTo($parentModel, $childModel);
    }
public function setParent(ModelInterface $childModel, ModelInterface $parentModel)
    {
        $condition = $this->relationships->getChildCondition(
            $parentModel->getProviderName(),
            $childModel->getProviderName()
        );
        if (!$condition instanceof ParentChildConditionInterface) {
            throw new DcGeneralRuntimeException(
                'No condition defined from ' . $parentModel->getProviderName() . ' to ' . $childModel->getProviderName()
            );
        }

        $condition->applyTo($parentModel, $childModel);
    }
public function setParent ( ModelInterface $ childModel , ModelInterface $ parentModel ) { $ condition = $ this -> relationships -> getChildCondition ( $ parentModel -> getProviderName ( ) , $ childModel -> getProviderName ( ) ) ; if ( ! $ condition instanceof ParentChildConditionInterface ) { throw new DcGeneralRuntimeException ( 'No condition defined from ' . $ parentModel -> getProviderName ( ) . ' to ' . $ childModel -> getProviderName ( ) ) ; } $ condition -> applyTo ( $ parentModel , $ childModel ) ; }
Set a model as the parent of another model.

@param ModelInterface $childModel  The model to become the child.
@param ModelInterface $parentModel The model to use as parent.

@return void

@throws DcGeneralRuntimeException When no condition is defined.
Set a model as the parent of another model .