You are here

public function PersistentObject::injectObjectManager 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::injectObjectManager()

Injects the Doctrine Object Manager.

Parameters

ObjectManager $objectManager:

ClassMetadata $classMetadata:

Return value

void

Throws

\RuntimeException

Overrides ObjectManagerAware::injectObjectManager

File

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

Class

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

Namespace

Doctrine\Common\Persistence

Code

public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) {
  if ($objectManager !== self::$objectManager) {
    throw new \RuntimeException("Trying to use PersistentObject with different ObjectManager instances. " . "Was PersistentObject::setObjectManager() called?");
  }
  $this->cm = $classMetadata;
}