John Davidson

php - Does the Symfony serializer support the Ignore attribute during denormalization

0 comments
Message:


Symfony allows one to preclude attributes from being serialized by applying the @Ignore attribute to the entities property.


Does this approach only work for normalization and will some other approach such as groups be required for denormalization? This appears to be the case, however, I have not found it explicitly documented and wish to confirm. Thanks



My Answer:
Yes, the @Ignore attribute in Symfony is used for excluding properties during normalization, not denormalization. For denormalization, you would typically use serialization groups to control which properties are included or excluded. Serialization groups allow you to define different sets of properties to be included or excluded during both normalization and denormalization processes.

So, in summary, if you want to exclude properties during denormalization, you should use serialization groups instead of the @Ignore attribute.

Rate this post

3 of 5 based on 2683 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us