Skip to content

Commit 0442752

Browse files
committed
[Serializer] Acme things
1 parent 57e6c94 commit 0442752

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/serializer.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Given you have the following object::
187187
And in the serialized form, all attributes must be prefixed by ``org_`` like
188188
the following::
189189

190-
{"org_name": "Acme SARL", "org_address": "Euratechnologies, 59000 Lille, France"}
190+
{"org_name": "Acme Inc.", "org_address": "123 Main Street, Big City"}
191191

192192
A custom Name Converter can handle such cases::
193193

@@ -222,11 +222,11 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
222222
$serializer = new Serializer(array(new JsonEncoder()), array($normalizer));
223223

224224
$obj = new Company();
225-
$obj->name = 'Acme SARL';
226-
$obj->address = 'Euratechnologies, 59000 Lille, France';
225+
$obj->name = 'Acme Inc.';
226+
$obj->address = '123 Main Street, Big City';
227227

228228
$json = $serializer->serialize($obj);
229-
// {"org_name": "Acme SARL", "org_address": "Euratechnologies, 59000 Lille, France"}
229+
// {"org_name": "Acme Inc.", "org_address": "123 Main Street, Big City"}
230230
$objCopy = $serializer->deserialize($json);
231231
// Same data as $obj
232232

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy