Doctrine\Common\Proxy\ProxyGenerator::setPlaceholder PHP Method

setPlaceholder() public method

Sets a placeholder to be replaced in the template.
public setPlaceholder ( string $name, string | callable $placeholder )
$name string
$placeholder string | callable
    public function setPlaceholder($name, $placeholder)
    {
        if (!is_string($placeholder) && !is_callable($placeholder)) {
            throw InvalidArgumentException::invalidPlaceholder($name);
        }
        $this->placeholders[$name] = $placeholder;
    }

Usage Example

 /**
  * Initializes a new instance of the <tt>ProxyFactory</tt> class that is
  * connected to the given <tt>DocumentManager</tt>.
  *
  * @param DocumentManager $manager
  * @param string          $proxyDir                              The directory to use for the proxy classes. It
  *                                                               must exist.
  * @param string          $proxyNamespace                        The namespace to use for the proxy classes.
  * @param int             $autoGenerate                          Whether to automatically generate proxy classes.
  */
 public function __construct(DocumentManager $manager, $proxyDir, $proxyNamespace, $autoGenerate = AbstractProxyFactory::AUTOGENERATE_NEVER)
 {
     $this->metadataFactory = $manager->getMetadataFactory();
     $this->uow = $manager->getUnitOfWork();
     $this->proxyNamespace = $proxyNamespace;
     $proxyGenerator = new ProxyGenerator($proxyDir, $proxyNamespace);
     $proxyGenerator->setPlaceholder('baseProxyInterface', 'Doctrine\\ODM\\OrientDB\\Proxy\\Proxy');
     parent::__construct($proxyGenerator, $this->metadataFactory, $autoGenerate);
 }
All Usage Examples Of Doctrine\Common\Proxy\ProxyGenerator::setPlaceholder