You are here

public function AbstractProxyFactory::resetUninitializedProxy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php \Doctrine\Common\Proxy\AbstractProxyFactory::resetUninitializedProxy()

Reset initialization/cloning logic for an un-initialized proxy

Parameters

\Doctrine\Common\Proxy\Proxy $proxy:

Return value

\Doctrine\Common\Proxy\Proxy

Throws

\Doctrine\Common\Proxy\Exception\InvalidArgumentException

File

vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php, line 172

Class

AbstractProxyFactory
Abstract factory for proxy objects.

Namespace

Doctrine\Common\Proxy

Code

public function resetUninitializedProxy(Proxy $proxy) {
  if ($proxy
    ->__isInitialized()) {
    throw InvalidArgumentException::unitializedProxyExpected($proxy);
  }
  $className = ClassUtils::getClass($proxy);
  $definition = isset($this->definitions[$className]) ? $this->definitions[$className] : $this
    ->getProxyDefinition($className);
  $proxy
    ->__setInitializer($definition->initializer);
  $proxy
    ->__setCloner($definition->cloner);
  return $proxy;
}