Skip to content

Commit 5b6ff21

Browse files
committed
minor #15317 [Serializer] Fixed occurence of an old FQCN notation (alexandre-daubois)
This PR was merged into the 4.4 branch. Discussion ---------- [Serializer] Fixed occurence of an old FQCN notation <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- af92684 [Serializer] Fixed occurence of an old FQCN notation
2 parents 1cb2e4d + af92684 commit 5b6ff21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/serializer.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ when this happens, set the ``AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES`` contex
174174
``false`` and provide an object that implements ``ClassMetadataFactoryInterface``
175175
when constructing the normalizer::
176176

177+
use App\Model\Person;
178+
177179
$data = <<<EOF
178180
<person>
179181
<name>foo</name>
@@ -189,7 +191,7 @@ when constructing the normalizer::
189191

190192
// this will throw a Symfony\Component\Serializer\Exception\ExtraAttributesException
191193
// because "city" is not an attribute of the Person class
192-
$person = $serializer->deserialize($data, 'App\Model\Person', 'xml', [
194+
$person = $serializer->deserialize($data, Person::class, 'xml', [
193195
AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES => false,
194196
]);
195197

0 commit comments

Comments
 (0)