Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Serializer] Deprecate annotations#19046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -279,6 +279,13 @@ for each format: | ||
| $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. should be removed? Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. or remove it in 7.0? MemberAuthor
| ||
| * Attributes in PHP files:: | ||
| use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; | ||
| use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; | ||
| $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); | ||
| * YAML files:: | ||
| use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; | ||
| @@ -293,6 +300,21 @@ for each format: | ||
| $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml')); | ||
| .. versionadded:: 6.4 | ||
| The | ||
| :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AttributeLoader` | ||
| was introduced in Symfony 6.4. Prior to this, the | ||
| :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` | ||
| must be used. | ||
| .. deprecated:: 6.4 | ||
| Reading annotations in PHP files is deprecated since Symfony 6.4. | ||
| Also, the | ||
| :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` | ||
| was deprecated in Symfony 6.4. | ||
| .. _component-serializer-attributes-groups-annotations: | ||
| .. _component-serializer-attributes-groups-attributes: | ||
| @@ -645,7 +667,7 @@ this is already set up and you only need to provide the configuration. Otherwise | ||
| use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; | ||
| use Symfony\Component\Serializer\Serializer; | ||
| $classMetadataFactory = new ClassMetadataFactory(newAttributeLoader()); | ||
| $metadataAwareNameConverter = new MetadataAwareNameConverter($classMetadataFactory); | ||
| @@ -1533,10 +1555,9 @@ Instead of throwing an exception, a custom callable can be executed when the | ||
| maximum depth is reached. This is especially useful when serializing entities | ||
| having unique identifiers:: | ||
| use Symfony\Component\Serializer\Annotation\MaxDepth; | ||
| use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; | ||
| use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; | ||
| use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; | ||
| use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; | ||
| use Symfony\Component\Serializer\Serializer; | ||
| @@ -1560,7 +1581,7 @@ having unique identifiers:: | ||
| $level3->id = 3; | ||
| $level2->child = $level3; | ||
| $classMetadataFactory = new ClassMetadataFactory(newAttributeLoader()); | ||
| // all callback parameters are optional (you can omit the ones you don't use) | ||
| $maxDepthHandler = function (object $innerObject, object $outerObject, string $attributeName, string $format = null, array $context = []): string { | ||
| @@ -1761,7 +1782,7 @@ this is already set up and you only need to provide the configuration. Otherwise | ||
| use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; | ||
| use Symfony\Component\Serializer\Serializer; | ||
| $classMetadataFactory = new ClassMetadataFactory(newAttributeLoader()); | ||
| $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); | ||