class ProxyFactory (View source)

This factory is used to create proxy objects for entities at runtime.

Methods

__construct(DocumentManager $dm, string $proxyDir, string $proxyNs, boolean $autoGenerate = false)

Initializes a new instance of the ProxyFactory class that is connected to the given DocumentManager.

object
getProxy(string $className, mixed $identifier)

Gets a reference proxy instance for the entity of the given type and identified by the given identifier.

generateProxyClasses(array $classes, string $toDir = null)

Generates proxy classes for all given classes.

Details

__construct(DocumentManager $dm, string $proxyDir, string $proxyNs, boolean $autoGenerate = false)

Initializes a new instance of the ProxyFactory class that is connected to the given DocumentManager.

Parameters

DocumentManager $dm The DocumentManager the new factory works for.
string $proxyDir The directory to use for the proxy classes. It must exist.
string $proxyNs The namespace to use for the proxy classes.
boolean $autoGenerate Whether to automatically generate proxy classes.

Exceptions

ProxyException

object getProxy(string $className, mixed $identifier)

Gets a reference proxy instance for the entity of the given type and identified by the given identifier.

Parameters

string $className
mixed $identifier

Return Value

object

generateProxyClasses(array $classes, string $toDir = null)

Generates proxy classes for all given classes.

Parameters

array $classes The classes (ClassMetadata instances) for which to generate proxies.
string $toDir The target directory of the proxy classes. If not specified, the directory configured on the Configuration of the DocumentManager used by this factory is used.