You are here

public function PersistentObject::injectObjectManager in Plug 7

Injects the Doctrine Object Manager.

Parameters

ObjectManager $objectManager:

ClassMetadata $classMetadata:

Return value

void

Throws

\RuntimeException

Overrides ObjectManagerAware::injectObjectManager

File

lib/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;
}