mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-23 16:22:10 +01:00
Remove mentions of AnnotationLoader
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
.. note::
|
||||
|
||||
In order to use the annotation loader, you should have installed the
|
||||
``doctrine/annotations`` and ``doctrine/cache`` packages with Composer.
|
||||
|
||||
.. tip::
|
||||
|
||||
Annotation classes aren't loaded automatically, so you must load them
|
||||
using a class loader like this::
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
|
||||
/** @var ClassLoader $loader */
|
||||
$loader = require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
|
||||
|
||||
return $loader;
|
||||
@@ -83,52 +83,6 @@ configure the locations of these files::
|
||||
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::addXmlMappings`
|
||||
to configure an array of file paths.
|
||||
|
||||
The AnnotationLoader
|
||||
--------------------
|
||||
|
||||
.. deprecated:: 6.4
|
||||
|
||||
The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader`
|
||||
is deprecated since Symfony 6.4, use the
|
||||
:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader`
|
||||
instead.
|
||||
|
||||
The component provides an
|
||||
:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` to get
|
||||
the metadata from the attributes of the class::
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
// ...
|
||||
|
||||
class User
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
protected string $name;
|
||||
}
|
||||
|
||||
To enable the annotation loader, call the
|
||||
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` method::
|
||||
|
||||
use Symfony\Component\Validator\Validation;
|
||||
|
||||
$validator = Validation::createValidatorBuilder()
|
||||
->enableAnnotationMapping()
|
||||
->getValidator();
|
||||
|
||||
To disable the annotation loader after it was enabled, call
|
||||
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`.
|
||||
|
||||
.. deprecated:: 6.4
|
||||
|
||||
The :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping`
|
||||
and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`
|
||||
methods are deprecated since Symfony 6.4, use the
|
||||
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAttributeMapping`
|
||||
and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAttributeMapping`
|
||||
methods instead.
|
||||
|
||||
.. include:: /_includes/_annotation_loader_tip.rst.inc
|
||||
|
||||
The AttributeLoader
|
||||
-------------------
|
||||
|
||||
|
||||
@@ -2701,18 +2701,6 @@ settings is configured.
|
||||
|
||||
.. _reference-validation-enable_annotations:
|
||||
|
||||
enable_annotations
|
||||
..................
|
||||
|
||||
**type**: ``boolean`` **default**: ``true``
|
||||
|
||||
If this option is enabled, validation constraints can be defined using annotations or `PHP attributes`_.
|
||||
|
||||
.. deprecated:: 6.4
|
||||
|
||||
This option is deprecated since Symfony 6.4, use the ``enable_attributes``
|
||||
option instead.
|
||||
|
||||
enable_attributes
|
||||
.................
|
||||
|
||||
@@ -2899,18 +2887,6 @@ Whether to enable the ``serializer`` service or not in the service container.
|
||||
|
||||
.. _reference-serializer-enable_annotations:
|
||||
|
||||
enable_annotations
|
||||
..................
|
||||
|
||||
**type**: ``boolean`` **default**: ``true``
|
||||
|
||||
If this option is enabled, serialization groups can be defined using annotations or attributes.
|
||||
|
||||
.. deprecated:: 6.4
|
||||
|
||||
This option is deprecated since Symfony 6.4, use the ``enable_attributes``
|
||||
option instead.
|
||||
|
||||
enable_attributes
|
||||
.................
|
||||
|
||||
|
||||
Reference in New Issue
Block a user