Doctrine\OXM\Proxy\ProxyFactory::getProxy PHP Метод

getProxy() публичный Метод

Gets a reference proxy instance for the xml-entity of the given type and identified by the given identifier.
public getProxy ( string $className, mixed $identifier ) : object
$className string
$identifier mixed
Результат object
    public function getProxy($className, $identifier)
    {
        $proxyClassName = str_replace('\\', '', $className) . 'Proxy';
        $fqn = $this->proxyNamespace . '\\' . $proxyClassName;
        if (!class_exists($fqn, false)) {
            $fileName = $this->proxyDir . DIRECTORY_SEPARATOR . $proxyClassName . '.php';
            if ($this->autoGenerate) {
                $this->generateProxyClass($this->xem->getClassMetadata($className), $proxyClassName, $fileName, self::$proxyClassTemplate);
            }
            require $fileName;
        }
        if (!$this->xem->getMetadataFactory()->hasMetadataFor($fqn)) {
            $this->xem->getMetadataFactory()->setMetadataFor($fqn, $this->xem->getClassMetadata($className));
        }
        $documentPersister = $this->xem->getUnitOfWork()->getXmlEntityPersister($className);
        return new $fqn($documentPersister, $identifier);
    }