You are here

public function AbstractProxyFactory::resetUninitializedProxy in Plug 7

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

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