Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Added the annotation namespace registration with the AnnotationRegistry #10

merged 1 commit into from

4 participants


Since the AnnotationReaders use the AnnotationRegistry to load annotation classes rather than the registered autoloaders the annotation namespace must be registered on the AnnotationRegistry to load properly. This did not reflect in the docs.



This has cost me too much time. Was about to fork and fix the docs myself.

The error that is returned from couchdb-odm is also incredibly vague on this one. Including it here in case it helps someone find it from a search engine:

Fatal error: Uncaught exception 'Doctrine\ODM\CouchDB\Mapping\MappingException' with message 'Class TestDocument is not a valid document or mapped super class.' in
/couchdb/vendor/doctrine/couchdb-odm/lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php on line 23


it should be noted that this is obviously only necessary when using annotations

@beberlei beberlei merged commit c144db2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 21, 2012
  1. @marnusw

    Added the annotation namespace registration with the AnnotationRegist…

    marnusw authored
    …ry to the autoloader code blocks.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 en/reference/configuration.rst
9 en/reference/configuration.rst
@@ -23,7 +23,8 @@ You have to make sure that both dependencies are installed and autoloadable.
The Github checkout of comes with a submodule of the Doctrine Common library. It contains
the ``Doctrine\Common\ClassLoader`` which should be used for autoloading all the necessary
-Doctrine classes.
+Doctrine classes. It is also necessary to register the annotation namespace with the
+AnnotationRegistry so the Doctrine annotation classes can be loaded on demand.
.. code-block:: php
@@ -43,6 +44,9 @@ Doctrine classes.
$loader = new \Doctrine\Common\ClassLoader("Symfony", $couchPath . "/vendor");
+ $annotationNs = 'Doctrine\\ODM\\CouchDB\\Mapping\\Annotations';
+ Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($annotationNs, $couchPath);
If Doctrine Common is installed via PEAR the ClassLoader can be loaded
from the include path:
@@ -63,6 +67,9 @@ from the include path:
$loader = new \Doctrine\Common\ClassLoader("Symfony");
+ $annotationNs = 'Doctrine\\ODM\\CouchDB\\Mapping\\Annotations';
+ Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($annotationNs, $couchPath);
Obtaining the DocumentManager
Something went wrong with that request. Please try again.