You are here

private function PersistentObject::completeOwningSide in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php \Doctrine\Common\Persistence\PersistentObject::completeOwningSide()

If this is an inverse side association, completes the owning side.

Parameters

string $field:

ClassMetadata $targetClass:

object $targetObject:

Return value

void

2 calls to PersistentObject::completeOwningSide()
PersistentObject::add in vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php
Adds an object to a collection.
PersistentObject::set in vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php
Sets a persistent fields value.

File

vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php, line 167

Class

PersistentObject
PersistentObject base class that implements getter/setter methods for all mapped fields and associations by overriding __call.

Namespace

Doctrine\Common\Persistence

Code

private function completeOwningSide($field, $targetClass, $targetObject) {

  // add this object on the owning side as well, for obvious infinite recursion
  // reasons this is only done when called on the inverse side.
  if ($this->cm
    ->isAssociationInverseSide($field)) {
    $mappedByField = $this->cm
      ->getAssociationMappedByTargetField($field);
    $targetMetadata = self::$objectManager
      ->getClassMetadata($targetClass);
    $setter = ($targetMetadata
      ->isCollectionValuedAssociation($mappedByField) ? "add" : "set") . $mappedByField;
    $targetObject
      ->{$setter}($this);
  }
}