Skip to content

[PropertyInfo] Document setting serializer_groups to null in the SerializerExtractor #13825

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion components/property_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,18 @@ with the ``property_info`` service in the Symfony Framework::
$serializerExtractor = new SerializerExtractor($serializerClassMetadataFactory);

// List information.
$serializerExtractor->getProperties($class);
$serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]);

.. note::

The ``serializer_groups`` option must be provided in order to have a value different than ``null`` returned.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this into a PHP comment in the above example:

- // List information.
+ // The `serializer_groups` option must be configured (may be set to null)


If ``serializer_groups`` is set to ``null``, serializer groups metadata won't be checked but you will get only the properties
considered by the Serializer Component (notably the ``@Ignore`` annotation is taken into account).
Comment on lines +444 to +445
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best to remove the .. note:: and make this a normal paragraph

Suggested change
If ``serializer_groups`` is set to ``null``, serializer groups metadata won't be checked but you will get only the properties
considered by the Serializer Component (notably the ``@Ignore`` annotation is taken into account).
If ``serializer_groups`` is set to ``null``, serializer groups metadata won't be checked but you
will get only the properties considered by the Serializer Component (notably the ``@Ignore``
annotation is taken into account).


.. versionadded:: 5.2

Support for the ``null`` value in ``serializer_groups`` was introduced in Symfony 5.2.

DoctrineExtractor
~~~~~~~~~~~~~~~~~
Expand Down