Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3467fc1

Browse files
committed
[#6975] some minor tweaks
1 parentf156216 commit3467fc1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎components/serializer.rst‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,14 @@ needs three parameters:
152152
#. The name of the class this information will be decoded to
153153
#. The encoder used to convert that information into an array
154154

155-
By default, additional attributes that are not mapped to the denormalized object will be ignored
156-
by the Serializer component. Setthe ``allow_extra_attributes`` keyof thedeserializationcontextto ``false``
157-
to let the serializer throw an exception when additional attributes are passed.
155+
..versionadded::3.3
156+
Support forthe ``allow_extra_attributes`` keyin the contextwas introduced
157+
in Symfony 3.3.
158158

159-
This will throw an:class:`Symfony\\Component\\Serializer\\Exception\\ExtraAttributesException` exception,
160-
because city is not an attribute of the ``Person`` class::
159+
By default, additional attributes that are not mapped to the denormalized
160+
object will be ignored by the Serializer component. Set the ``allow_extra_attributes``
161+
key of the deserialization context to ``false`` to let the serializer throw
162+
an exception when additional attributes are passed::
161163

162164
$data = <<<EOF
163165
<person>
@@ -167,6 +169,8 @@ because city is not an attribute of the ``Person`` class::
167169
</person>
168170
EOF;
169171

172+
// this will throw a Symfony\Component\Serializer\Exception\ExtraAttributesException
173+
// because "city" is not an attribute of the Person class
170174
$person = $serializer->deserialize($data, 'Acme\Person', 'xml', array(
171175
'allow_extra_attributes' => false,
172176
));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp