diff --git a/docs/en/reference/advanced-configuration.rst b/docs/en/reference/advanced-configuration.rst index 5c8ad01d1..c1b96294b 100644 --- a/docs/en/reference/advanced-configuration.rst +++ b/docs/en/reference/advanced-configuration.rst @@ -329,24 +329,51 @@ controls this behavior is: .. code-block:: php setAutoGenerateProxyClasses($bool); - $config->getAutoGenerateProxyClasses(); + $config->setAutoGenerateProxyClasses($mode); -The default value is ``TRUE`` for convenient development. However, -this setting is not optimal for performance and therefore not -recommended for a production environment. To eliminate the overhead -of proxy class generation during runtime, set this configuration -option to ``FALSE``. When you do this in a development environment, -note that you may get class/file not found errors if certain proxy -classes are not available or failing lazy-loads if new methods were -added to the entity class that are not yet in the proxy class. In -such a case, simply use the Doctrine Console to (re)generate the -proxy classes like so: +Possible values are: + +- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_NEVER`` + +Never autogenerate a proxy and rely that it was generated by some +process before deployment. + +To generate the proxies, use: .. code-block:: php +When you do this in a development environment, +note that you may get class/file not found errors if certain proxy +classes are not available or failing lazy-loads if new methods were +added to the entity class that are not yet in the proxy class. +In such a case, simply use the Doctrine Console to (re)generate the +proxy classes. + $ ./doctrine orm:generate-proxies +- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_ALWAYS`` + +Always generates a new proxy in every request. + +- ``Doctrine\Common\Proxy\AbstractProxyFactory::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. + +- ``Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_EVAL`` + +Generate the proxy classes using eval(), which avoids writing the +proxies to disk. This strategy is only sane for development. + +In a production environment, it is highly recommended to use +AUTOGENERATE_NEVER to allow for optimal performances. The other +options are interesting in development environment. + +Before v2.4, ``setAutoGenerateProxyClasses`` would accept a boolean +value. This is still possible, ``FALSE`` being equivalent to +AUTOGENERATE_NEVER and ``TRUE`` to AUTOGENERATE_ALWAYS. + Autoloading Proxies -------------------