/** * Gets a reference to the entity identified by the given type and identifier * without actually loading it, if the entity is not yet loaded. * * @param string $documentName The name of the entity type. * @param mixed $identifier The entity identifier. * @return object The entity reference. */ public function getReference($documentName, $identifier) { $class = $this->metadataFactory->getMetadataFor(ltrim($documentName, '\\')); // Check identity map first, if its already in there just return it. if ($document = $this->unitOfWork->tryGetById($identifier)) { return $document; } $document = $this->proxyFactory->getProxy($class->name, $identifier); $this->unitOfWork->registerManaged($document, $identifier, null); return $document; }
/** */ public function testWrongShortcut() { $this->setExpectedException('Fwk\\Core\\Exception'); ProxyFactory::factory(array('not', 'supported')); }