PHP Class Doctrine\Common\Proxy\ProxyGenerator

It builds proxies from given parameters, a template and class metadata.
Since: 2.4
Author: Marco Pivetta ([email protected])
Datei anzeigen Open project: doctrine/common Class Usage Examples

Protected Properties

Property Type Description
$placeholders string[] | callable[] Map of callables used to fill in placeholders set in the template.
$proxyClassTemplate string Template used as a blueprint to generate proxies.

Public Methods

Method Description
__construct ( string $proxyDirectory, string $proxyNamespace ) Initializes a new instance of the ProxyFactory class that is connected to the given EntityManager.
generateProxyClass ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, string | boolean $fileName = false ) Generates a proxy class file.
getProxyFileName ( string $className, string $baseDirectory = null ) : string Generates the Proxy file name.
setPlaceholder ( string $name, string | callable $placeholder ) Sets a placeholder to be replaced in the template.
setProxyClassTemplate ( string $proxyClassTemplate ) Sets the base template used to create proxy classes.

Private Methods

Method Description
buildParametersString ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, ReflectionMethod $method, array $parameters ) : string
formatType ( ReflectionType $type, ReflectionMethod $method, ReflectionParameter $parameter = null ) : string
generateClassName ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the original class name.
generateCloneImpl ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates implementation for the __clone method of proxies.
generateConstructorImpl ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the constructor code (un-setting public lazy loaded properties, setting identifier field values).
generateLazyPropertiesDefaults ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the array representation of lazy loaded public properties and their default values.
generateMagicGet ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the magic getter invoked when lazy loaded public properties are requested.
generateMagicIsset ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the magic issetter invoked when lazy loaded public properties are checked against isset().
generateMagicSet ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the magic setter (currently unused).
generateMethods ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates decorated methods by picking those available in the parent class.
generateNamespace ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the proxy namespace.
generateProxyShortClassName ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates the proxy short class name to be used in the template.
generateSleepImpl ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates implementation for the __sleep method of proxies.
generateWakeupImpl ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : string Generates implementation for the __wakeup method of proxies.
getLazyLoadedPublicProperties ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : mixed[] Generates the list of public properties to be lazy loaded, with their default values.
getMethodReturnType ( ReflectionMethod $method ) : string
getParameterNamesForInvoke ( array $parameters ) : string[]
getParameterNamesForParentCall ( array $parameters ) : string[]
getParameterType ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, ReflectionMethod $method, ReflectionParameter $parameter ) : string | null
isShortIdentifierGetter ( ReflectionMethod $method, Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : boolean Checks if the method is a short identifier getter.
shouldProxiedMethodReturn ( ReflectionMethod $method ) : boolean

Method Details

__construct() public method

Initializes a new instance of the ProxyFactory class that is connected to the given EntityManager.
public __construct ( string $proxyDirectory, string $proxyNamespace )
$proxyDirectory string The directory to use for the proxy classes. It must exist.
$proxyNamespace string The namespace to use for the proxy classes.

generateProxyClass() public method

Generates a proxy class file.
public generateProxyClass ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, string | boolean $fileName = false )
$class Doctrine\Common\Persistence\Mapping\ClassMetadata Metadata for the original class.
$fileName string | boolean Filename (full path) for the generated class. If none is given, eval() is used.

getProxyFileName() public method

Generates the Proxy file name.
public getProxyFileName ( string $className, string $baseDirectory = null ) : string
$className string
$baseDirectory string Optional base directory for proxy file name generation. If not specified, the directory configured on the Configuration of the EntityManager will be used by this factory.
return string

setPlaceholder() public method

Sets a placeholder to be replaced in the template.
public setPlaceholder ( string $name, string | callable $placeholder )
$name string
$placeholder string | callable

setProxyClassTemplate() public method

Sets the base template used to create proxy classes.
public setProxyClassTemplate ( string $proxyClassTemplate )
$proxyClassTemplate string

Property Details

$placeholders protected_oe property

Map of callables used to fill in placeholders set in the template.
protected string[]|callable[] $placeholders
return string[] | callable[]

$proxyClassTemplate protected_oe property

Template used as a blueprint to generate proxies.
protected string $proxyClassTemplate
return string