Skip to content

Commit

Permalink
Document autoload requirement for generated proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Feb 12, 2019
1 parent 6fba6e6 commit fa0a530
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/en/reference/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,14 @@ their mapping.
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm');
spl_autoload_register($config->getProxyManagerConfiguration()->getProxyAutoloader());
.. note::

The last call to ``spl_autoload_regiter`` is necessary to autoload generated
proxy classes. Without this, the proxy library would re-generate proxy
classes for every request. See the `tuning for production`_ documentation.

The easiest way to define mappings for our document classes is with annotations.
We'll need to specify an annotation driver in our configuration (with one or
more paths) and register the annotations for the driver:
Expand Down Expand Up @@ -496,3 +504,4 @@ please create separate clients for your application and ODM.
.. _MongoDB: https://www.mongodb.com/
.. _10gen: http://www.10gen.com
.. _Composer: http://getcomposer.org/
.. _tuning for production: https://ocramius.github.io/ProxyManager/docs/tuning-for-production.html
2 changes: 2 additions & 0 deletions docs/en/tutorials/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ instance. Read more about setting up the Doctrine MongoDB ODM in the
$dm = DocumentManager::create(null, $config);
spl_autoload_register($config->getProxyManagerConfiguration()->getProxyAutoloader());
Usage
-----

Expand Down

0 comments on commit fa0a530

Please sign in to comment.