diff --git a/doc/configuration.rst b/doc/configuration.rst index c3b68d3f9..5bd06e2ee 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -105,23 +105,22 @@ a serialization context from your callable and use it. ``->setDeserializationContextFactory(function () { /* ... */ })`` to be used with methods ``deserialize()`` and ``fromArray()``. - -Setting a default behaviour for skipping properties with empty values - `@SkipWhenEmpty` annotation +Setting a default behaviour for skipping properties with empty values - `SkipWhenEmpty`_ annotation --------------------------------------------------------------------------------------------------- -To avoid to specifying the annotation skipWhenEmpty for each property -it is possible to enable this behaviour in configuration by calling enableSkipWhenEmpty +To avoid to specifying the annotation ``@skipWhenEmpty`` for each property +it is possible to enable this behaviour in configuration by calling ``enableSkipWhenEmpty`` Example using with the SerializerBuilder:: -.. code-block :: php - use JMS\Serializer\SerializationContext; $serializer = JMS\Serializer\SerializerBuilder::create() ->setSerializationContextFactory(function () { + return SerializationContext::create() - ->enableSkipWhenEmpty() - ; + ->enableSkipWhenEmpty(); + }) - ->build() - ; + ->build(); + +.. _SkipWhenEmpty: reference/annotations.html#skipwhenempty \ No newline at end of file