public function AbstractProxyFactory::getProxy in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php \Doctrine\Common\Proxy\AbstractProxyFactory::getProxy()
Gets a reference proxy instance for the entity of the given type and identified by the given identifier.
Parameters
string $className:
array $identifier:
Return value
Throws
\Doctrine\Common\Proxy\Exception\OutOfBoundsException
File
- vendor/
doctrine/ common/ lib/ Doctrine/ Common/ Proxy/ AbstractProxyFactory.php, line 115
Class
- AbstractProxyFactory
- Abstract factory for proxy objects.
Namespace
Doctrine\Common\ProxyCode
public function getProxy($className, array $identifier) {
$definition = isset($this->definitions[$className]) ? $this->definitions[$className] : $this
->getProxyDefinition($className);
$fqcn = $definition->proxyClassName;
$proxy = new $fqcn($definition->initializer, $definition->cloner);
foreach ($definition->identifierFields as $idField) {
if (!isset($identifier[$idField])) {
throw OutOfBoundsException::missingPrimaryKeyValue($className, $idField);
}
$definition->reflectionFields[$idField]
->setValue($proxy, $identifier[$idField]);
}
return $proxy;
}