Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 86f822b

Browse files
committed
minor #16782 [Serializer] Document support of canners (SzymonKaminski)
This PR was merged into the 6.1 branch. Discussion ---------- [Serializer] Document support of canners This PR aims to resolve #16759. Commits ------- 1f0c87c [Serializer] Document support of canners
2 parents 5b350cd + 1f0c87c commit 86f822b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

components/serializer.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,12 @@ If you are using isser methods (methods prefixed by ``is``, like
746746
``App\Model\Person::isSportsperson()``), the Serializer component will
747747
automatically detect and use it to serialize related attributes.
748748

749-
The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``add``
750-
and ``remove``.
749+
The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``can``,
750+
``add`` and ``remove``.
751+
752+
.. versionadded:: 6.1
753+
754+
The support of canners (methods prefixed by ``can``) was introduced in Symfony 6.1.
751755

752756
Using Callbacks to Serialize Properties with Object Instances
753757
-------------------------------------------------------------
@@ -811,12 +815,12 @@ The Serializer component provides several built-in normalizers:
811815
:class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer`
812816
This normalizer leverages the :doc:`PropertyAccess Component </components/property_access>`
813817
to read and write in the object. It means that it can access to properties
814-
directly and through getters, setters, hassers, issers, adders and removers. It supports
815-
calling the constructor during the denormalization process.
818+
directly and through getters, setters, hassers, issers, canners, adders and removers.
819+
It supports calling the constructor during the denormalization process.
816820

817821
Objects are normalized to a map of property names and values (names are
818-
generated by removing the ``get``, ``set``, ``has``, ``is``, ``add`` or ``remove`` prefix from
819-
the method name and transforming the first letter to lowercase; e.g.
822+
generated by removing the ``get``, ``set``, ``has``, ``is``, ``can``, ``add`` or ``remove``
823+
prefix from the method name and transforming the first letter to lowercase; e.g.
820824
``getFirstName()`` -> ``firstName``).
821825

822826
The ``ObjectNormalizer`` is the most powerful normalizer. It is configured by

0 commit comments

Comments
 (0)