Skip to content

Commit 3b85367

Browse files
committed
minor #7511 added a tip to register annotations namespaces (Noel Garcia, Noel, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- added a tip to register annotations namespaces Commits ------- 1ce3a43 Removed the reference to specific Symfony files f56b5af Moved the note before the label 19c89da Minor reword 0ddf3d2 moved the tips to an include fragment file 84c1541 added a tip to register annotations namespaces
2 parents d0dcc10 + 1ce3a43 commit 3b85367

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. note::
2+
3+
In order to use the annotation loader, you should have installed the
4+
``doctrine/annotations`` and ``doctrine/cache`` packages with Composer.
5+
6+
.. tip::
7+
8+
Annotation classes aren't loaded automatically, so you must load them
9+
using a class loader like this::
10+
11+
      use Composer\Autoload\ClassLoader;
12+
use Doctrine\Common\Annotations\AnnotationRegistry;
13+
14+
/** @var ClassLoader $loader */
15+
$loader = require __DIR__.'/../vendor/autoload.php';
16+
17+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
18+
19+
return $loader;

components/routing.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ Last but not least there are
312312
route definitions from class annotations. The specific details are left
313313
out here.
314314

315+
.. include:: /_includes/_rewrite_rule_tip.rst.inc
316+
315317
The all-in-one Router
316318
~~~~~~~~~~~~~~~~~~~~~
317319

components/serializer.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ You are now able to serialize only attributes in the groups you want::
310310
);
311311
// $obj2 = MyObj(foo: 'foo', bar: 'bar')
312312

313+
.. include:: /_includes/_rewrite_rule_tip.rst.inc
314+
313315
.. _ignoring-attributes-when-serializing:
314316

315317
Ignoring Attributes

components/validator/resources.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ method. It takes an optional annotation reader instance, which defaults to
119119
To disable the annotation loader after it was enabled, call
120120
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`.
121121

122-
.. note::
123-
124-
In order to use the annotation loader, you should have installed the
125-
``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_.
122+
.. include:: /_includes/_rewrite_rule_tip.rst.inc
126123

127124
Using Multiple Loaders
128125
----------------------

0 commit comments

Comments
 (0)