@@ -51,8 +51,8 @@ method. This is done using the index notation that is used in PHP::
5151 'first_name' => 'Wouter',
5252 );
5353
54- echo $accessor->getValue($person, '[first_name]'); // 'Wouter'
55- echo $accessor->getValue($person, '[age]'); // null
54+ dump( $accessor->getValue($person, '[first_name]') ); // 'Wouter'
55+ dump( $accessor->getValue($person, '[age]') ); // null
5656
5757As you can see, the method will return ``null `` if the index does not exists.
5858
@@ -68,8 +68,8 @@ You can also use multi dimensional arrays::
6868 )
6969 );
7070
71- echo $accessor->getValue($persons, '[0][first_name]'); // 'Wouter'
72- echo $accessor->getValue($persons, '[1][first_name]'); // 'Ryan'
71+ dump( $accessor->getValue($persons, '[0][first_name]') ); // 'Wouter'
72+ dump( $accessor->getValue($persons, '[1][first_name]') ); // 'Ryan'
7373
7474Reading from Objects
7575--------------------
@@ -86,13 +86,13 @@ To read from properties, use the "dot" notation::
8686 $person = new Person();
8787 $person->firstName = 'Wouter';
8888
89- echo $accessor->getValue($person, 'firstName'); // 'Wouter'
89+ dump( $accessor->getValue($person, 'firstName') ); // 'Wouter'
9090
9191 $child = new Person();
9292 $child->firstName = 'Bar';
9393 $person->children = array($child);
9494
95- echo $accessor->getValue($person, 'children[0].firstName'); // 'Bar'
95+ dump( $accessor->getValue($person, 'children[0].firstName') ); // 'Bar'
9696
9797.. caution ::
9898
@@ -122,7 +122,7 @@ property name (``first_name`` becomes ``FirstName``) and prefixes it with
122122
123123 $person = new Person();
124124
125- echo $accessor->getValue($person, 'first_name'); // 'Wouter'
125+ dump( $accessor->getValue($person, 'first_name') ); // 'Wouter'
126126
127127Using Hassers/Issers
128128~~~~~~~~~~~~~~~~~~~~
@@ -151,10 +151,10 @@ getters, this means that you can do something like this::
151151 $person = new Person();
152152
153153 if ($accessor->getValue($person, 'author')) {
154- echo 'He is an author';
154+ dump( 'He is an author') ;
155155 }
156156 if ($accessor->getValue($person, 'children')) {
157- echo 'He has children';
157+ dump( 'He has children') ;
158158 }
159159
160160This will produce: ``He is an author ``
@@ -179,7 +179,7 @@ The ``getValue`` method can also use the magic ``__get`` method::
179179
180180 $person = new Person();
181181
182- echo $accessor->getValue($person, 'Wouter'); // array(...)
182+ dump( $accessor->getValue($person, 'Wouter') ); // array(...)
183183
184184Magic ``__call() `` Method
185185~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -215,7 +215,7 @@ enable this feature by using :class:`Symfony\\Component\\PropertyAccess\\Propert
215215 ->enableMagicCall()
216216 ->getPropertyAccessor();
217217
218- echo $accessor->getValue($person, 'wouter'); // array(...)
218+ dump( $accessor->getValue($person, 'wouter') ); // array(...)
219219
220220.. versionadded :: 2.3
221221 The use of magic ``__call() `` method was introduced in Symfony 2.3.
@@ -239,9 +239,9 @@ method::
239239
240240 $accessor->setValue($person, '[first_name]', 'Wouter');
241241
242- echo $accessor->getValue($person, '[first_name]'); // 'Wouter'
242+ dump( $accessor->getValue($person, '[first_name]') ); // 'Wouter'
243243 // or
244- // echo $person['first_name']; // 'Wouter'
244+ // dump( $person['first_name']) ; // 'Wouter'
245245
246246Writing to Objects
247247------------------
@@ -275,9 +275,9 @@ can use setters, the magic ``__set`` method or properties to set values::
275275 $accessor->setValue($person, 'lastName', 'de Jong');
276276 $accessor->setValue($person, 'children', array(new Person()));
277277
278- echo $person->firstName; // 'Wouter'
279- echo $person->getLastName(); // 'de Jong'
280- echo $person->children; // array(Person());
278+ dump( $person->firstName) ; // 'Wouter'
279+ dump( $person->getLastName() ); // 'de Jong'
280+ dump( $person->children) ; // array(Person());
281281
282282You can also use ``__call `` to set values but you need to enable the feature,
283283see `Enable other Features `_.
@@ -313,7 +313,7 @@ see `Enable other Features`_.
313313
314314 $accessor->setValue($person, 'wouter', array(...));
315315
316- echo $person->getWouter(); // array(...)
316+ dump( $person->getWouter() ); // array(...)
317317
318318 Mixing Objects and Arrays
319319-------------------------
@@ -345,7 +345,7 @@ You can also mix objects and arrays::
345345 $accessor->setValue($person, 'children[0].firstName', 'Wouter');
346346 // equal to $person->getChildren()[0]->firstName = 'Wouter'
347347
348- echo 'Hello '.$accessor->getValue($person, 'children[0].firstName'); // 'Wouter'
348+ dump( 'Hello '.$accessor->getValue($person, 'children[0].firstName') ); // 'Wouter'
349349 // equal to $person->getChildren()[0]->firstName
350350
351351Enable other Features
0 commit comments