From 2fe03a4329ce934c758877311d0df38574b05583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Fri, 14 Apr 2023 16:14:45 +0200 Subject: [PATCH] [Serializer] Add `debug:serializer` command --- serializer.rst | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/serializer.rst b/serializer.rst index 22b0a7b567c..94be1fa0540 100644 --- a/serializer.rst +++ b/serializer.rst @@ -491,6 +491,50 @@ value: $framework->serializer()->nameConverter('serializer.name_converter.camel_case_to_snake_case'); }; +Debugging the Serializer +------------------------ + +Use the ``debug:serializer`` command to dump the serializer metadata of a +given class: + +.. code-block:: terminal + + $ php bin/console debug:serializer 'App\Entity\Book' + + App\Entity\Book + --------------- + + +----------+------------------------------------------------------------+ + | Property | Options | + +----------+------------------------------------------------------------+ + | name | [ | + | | "groups" => [ | + | | "book:read", | + | | "book:write", | + | | ] | + | | "maxDepth" => 1, | + | | "serializedName" => "book_name" | + | | "ignore" => false | + | | "normalizationContexts" => [], | + | | "denormalizationContexts" => [] | + | | ] | + | isbn | [ | + | | "groups" => [ | + | | "book:read", | + | | ] | + | | "maxDepth" => null, | + | | "serializedName" => null | + | | "ignore" => false | + | | "normalizationContexts" => [], | + | | "denormalizationContexts" => [] | + | | ] | + +----------+------------------------------------------------------------+ + +.. versionadded:: 6.3 + + The debug:serializer`` command was introduced in Symfony 6.3. + + Going Further with the Serializer ---------------------------------