Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document autoload requirement for generated proxies #1954

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/en/reference/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@ 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`_ chapter in
ProxyManager's 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 +505,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