Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #5 from gimler/register_annontation_namespace
Browse files Browse the repository at this point in the history
correct method name
  • Loading branch information
guilhermeblanco committed Jun 27, 2012
2 parents d9e69bd + 87ea8b8 commit 3cb594e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions en/reference/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ To anticipate the configuration section, making the above PHP class work with Do
use Doctrine\Common\Annotations\AnnotationRegistry;
AnnotationRegistry::registerFile("/path/to/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
AnnotationRegistry::registerAnnotationNamespace("Symfony\Component\Validator\Constraint", "/path/to/symfony/src");
AnnotationRegistry::registerAnnotationNamespace("MyProject\Annotations", "/path/to/myproject/src");
AnnotationRegistry::registerAutoloadNamespace("Symfony\Component\Validator\Constraint", "/path/to/symfony/src");
AnnotationRegistry::registerAutoloadNamespace("MyProject\Annotations", "/path/to/myproject/src");
$reader = new AnnotationReader();
AnnotationReader::addGlobalIgnoredName('dummy');
The second block with the annotation registry calls registers all the three different annotation namespaces that are used.
Doctrine saves all its annotations in a single file, that is why ``AnnotationRegistry#registerFile`` is used in contrast to
``AnnotationRegistry#registerAnnotationNamespace`` which creates a PSR-0 compatible loading mechanism for class to file names.
``AnnotationRegistry#registerAutoloadNamespace`` which creates a PSR-0 compatible loading mechanism for class to file names.

In the third block, we create the actual AnnotationReader instance. Note that we also add "dummy" to the global list of annotations
for which we do not throw exceptions. Setting this is necessary in our example case, otherwise @dummy would trigger an exception to
Expand Down Expand Up @@ -523,4 +523,4 @@ IDE Support

Some IDEs already provide support for annotations:

- Eclipse via the `Symfony2 Plugin <http://symfony.dubture.com/>`_
- Eclipse via the `Symfony2 Plugin <http://symfony.dubture.com/>`_

0 comments on commit 3cb594e

Please sign in to comment.