abstract class AbstractProxyFactory (View source)

deprecated The Doctrine\Common\Proxy component is deprecated, please use ocramius/proxy-manager instead.

Abstract factory for proxy objects.

Constants

AUTOGENERATE_NEVER

Never autogenerate a proxy and rely that it was generated by some process before deployment.

AUTOGENERATE_ALWAYS

Always generates a new proxy in every request.

This is only sane during development.

AUTOGENERATE_FILE_NOT_EXISTS

Autogenerate the proxy class when the proxy file does not exist.

This strategy causes a file exists call whenever any proxy is used the first time in a request.

AUTOGENERATE_EVAL

Generate the proxy classes using eval().

This strategy is only sane for development, and even then it gives me the creeps a little.

AUTOGENERATE_MODES

Methods

__construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, bool|int $autoGenerate)

No description

getProxy(string $className, array $identifier)

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

int
generateProxyClasses(array $classes, string $proxyDir = null)

Generates proxy classes for all given classes.

resetUninitializedProxy(Proxy $proxy)

Reset initialization/cloning logic for an un-initialized proxy

bool
skipClass(ClassMetadata $metadata)

Determine if this class should be skipped during proxy generation.

createProxyDefinition(string $className)

No description

Details

__construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, bool|int $autoGenerate)

Parameters

ProxyGenerator $proxyGenerator
ClassMetadataFactory $metadataFactory
bool|int $autoGenerate

Exceptions

InvalidArgumentException When auto generate mode is not valid.

Proxy getProxy(string $className, array $identifier)

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

Parameters

string $className
array $identifier

Return Value

Proxy

Exceptions

OutOfBoundsException

int generateProxyClasses(array $classes, string $proxyDir = null)

Generates proxy classes for all given classes.

Parameters

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

Return Value

int Number of generated proxies.

Proxy resetUninitializedProxy(Proxy $proxy)

Reset initialization/cloning logic for an un-initialized proxy

Parameters

Proxy $proxy

Return Value

Proxy

Exceptions

InvalidArgumentException

abstract protected bool skipClass(ClassMetadata $metadata)

Determine if this class should be skipped during proxy generation.

Parameters

ClassMetadata $metadata

Return Value

bool

abstract protected ProxyDefinition createProxyDefinition(string $className)

Parameters

string $className

Return Value

ProxyDefinition