From 7bd39e853d8caf7d467d13c0efb900eb5b647a16 Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Sat, 7 Mar 2020 10:14:31 +0100 Subject: [PATCH] Add precisions about annotations autoloading --- docs/en/index.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/en/index.rst b/docs/en/index.rst index 60f3ffe9d..7a6be485b 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -63,6 +63,12 @@ annotations of a class. A common one is .. code-block:: php + use Doctrine\Common\Annotations\AnnotationReader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + // Deprecated and will be removed in 2.0 but currently needed + AnnotationRegistry::registerLoader('class_exists'); + $reflectionClass = new ReflectionClass(Foo::class); $property = $reflectionClass->getProperty('bar'); @@ -73,6 +79,13 @@ annotations of a class. A common one is A reader has multiple methods to access the annotations of a class. +Note that ``AnnotationRegistry::registerLoader('class_exists')`` only works +if you already have an autoloader configured (i.e. composer autoloader). +Otherwise, :ref:`please take a look to the other annotation autoload mechanisms `. + +A reader has multiple methods to access the annotations +of a class. + :ref:`Read more about handling annotations. ` IDE Support