File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ Serializing an object
51
51
For the sake of this example, let's ssume the following class already
52
52
exists in our project::
53
53
54
+ namespace Acme;
55
+
54
56
class Person
55
57
{
56
58
private $age;
@@ -82,7 +84,7 @@ exists in our project::
82
84
Now, if we want to serialize this object into JSON, we only need to
83
85
use the Serializer service created before::
84
86
85
- $person = new Person();
87
+ $person = new Acme\ Person();
86
88
$person->setName('foo');
87
89
$person->setAge(99);
88
90
@@ -105,7 +107,7 @@ of the `People` class would be encoded in XML format::
105
107
</person>
106
108
EOF;
107
109
108
- $person = $serializer->deserialize($data,'Person','xml');
110
+ $person = $serializer->deserialize($data,'Acme\ Person','xml');
109
111
110
112
In this case, `Serializer::deserialize ` needs three parameters:
111
113
You can’t perform that action at this time.
0 commit comments