@@ -374,6 +374,9 @@ You can also mix objects and arrays::
374374Custom method calls and virtual properties in a class
375375-----------------------------------------------------
376376
377+ .. versionadded :: 3.4
378+ Support for custom accessors was introduced in Symfony 3.4.
379+
377380Sometimes you may not want the component to guess which method has to be called
378381when reading or writing properties. This is especially interesting when property
379382names are not in English or its singularization is not properly detected.
@@ -400,7 +403,7 @@ configuration files.
400403There are four method calls that can be overriden: ``getter ``, ``setter ``, ``adder `` and
401404``remover ``.
402405
403- When using annotations you can precede a property with ``@Property `` to state which
406+ When using annotations you can precede a property with ``@PropertyAccessor `` to state which
404407method should be called when a get, set, add or remove operation is needed on the
405408property.
406409
@@ -409,17 +412,17 @@ property.
409412 .. code-block :: php-annotations
410413
411414 // ...
412- use Symfony\Component\PropertyAccess\Annotation\Property ;
415+ use Symfony\Component\PropertyAccess\Annotation\PropertyAccessor ;
413416
414417 class Person
415418 {
416419 /**
417- * @Property (getter="getFullName", setter="setFullName")
420+ * @PropertyAccessor (getter="getFullName", setter="setFullName")
418421 */
419422 private $name;
420423
421424 /**
422- * @Property (adder="addNewChild", remover="discardChild")
425+ * @PropertyAccessor (adder="addNewChild", remover="discardChild")
423426 */
424427 private $children;
425428
@@ -474,8 +477,8 @@ Then, using the overriden methods is automatic:
474477 // will return 'Hello John Doe'
475478
476479 You can also associate a particular method with an operation on a property
477- using the ``@PropertyGetter ``, ``@PropertySetter ``, ``@PropertyAdder `` and
478- ``@PropertyRemover `` annotations. All of them take only one parameter: ``property ``.
480+ using the ``@GetterAccessor ``, ``@SetterAccessor ``, ``@AdderAccessor `` and
481+ ``@RemoverAccessor `` annotations. All of them take only one parameter: ``property ``.
479482
480483This allows creating virtual properties that are not directly stored in the
481484object:
@@ -485,8 +488,8 @@ object:
485488 .. code-block :: php-annotations
486489
487490 // ...
488- use Symfony\Component\PropertyAccess\Annotation\PropertyGetter ;
489- use Symfony\Component\PropertyAccess\Annotation\PropertySetter ;
491+ use Symfony\Component\PropertyAccess\Annotation\GetterAccessor ;
492+ use Symfony\Component\PropertyAccess\Annotation\SetterAccessor ;
490493
491494 class Invoice
492495 {
@@ -497,7 +500,7 @@ object:
497500 // Notice that there is no real "total" property
498501
499502 /**
500- * @PropertyGetter (property="total")
503+ * @GetterAccessor (property="total")
501504 */
502505 public function getTotal()
503506 {
@@ -506,7 +509,7 @@ object:
506509
507510 // Notice that 'property' can be omitted in the parameter
508511 /**
509- * @PropertySetter ("total")
512+ * @SetterAccessor ("total")
510513 *
511514 * @param mixed $total
512515 */
0 commit comments