@@ -427,6 +427,9 @@ You can also mix objects and arrays::
427427Custom method calls and virtual properties in a class
428428-----------------------------------------------------
429429
430+ .. versionadded :: 3.4
431+ Support for custom accessors was introduced in Symfony 3.4.
432+
430433Sometimes you may not want the component to guess which method has to be called
431434when reading or writing properties. This is especially interesting when property
432435names are not in English or its singularization is not properly detected.
@@ -453,7 +456,7 @@ configuration files.
453456There are four method calls that can be overriden: ``getter ``, ``setter ``, ``adder `` and
454457``remover ``.
455458
456- When using annotations you can precede a property with ``@Property `` to state which
459+ When using annotations you can precede a property with ``@PropertyAccessor `` to state which
457460method should be called when a get, set, add or remove operation is needed on the
458461property.
459462
@@ -462,17 +465,17 @@ property.
462465 .. code-block :: php-annotations
463466
464467 // ...
465- use Symfony\Component\PropertyAccess\Annotation\Property ;
468+ use Symfony\Component\PropertyAccess\Annotation\PropertyAccessor ;
466469
467470 class Person
468471 {
469472 /**
470- * @Property (getter="getFullName", setter="setFullName")
473+ * @PropertyAccessor (getter="getFullName", setter="setFullName")
471474 */
472475 private $name;
473476
474477 /**
475- * @Property (adder="addNewChild", remover="discardChild")
478+ * @PropertyAccessor (adder="addNewChild", remover="discardChild")
476479 */
477480 private $children;
478481
@@ -527,8 +530,8 @@ Then, using the overriden methods is automatic:
527530 // will return 'Hello John Doe'
528531
529532 You can also associate a particular method with an operation on a property
530- using the ``@PropertyGetter ``, ``@PropertySetter ``, ``@PropertyAdder `` and
531- ``@PropertyRemover `` annotations. All of them take only one parameter: ``property ``.
533+ using the ``@GetterAccessor ``, ``@SetterAccessor ``, ``@AdderAccessor `` and
534+ ``@RemoverAccessor `` annotations. All of them take only one parameter: ``property ``.
532535
533536This allows creating virtual properties that are not directly stored in the
534537object:
@@ -538,8 +541,8 @@ object:
538541 .. code-block :: php-annotations
539542
540543 // ...
541- use Symfony\Component\PropertyAccess\Annotation\PropertyGetter ;
542- use Symfony\Component\PropertyAccess\Annotation\PropertySetter ;
544+ use Symfony\Component\PropertyAccess\Annotation\GetterAccessor ;
545+ use Symfony\Component\PropertyAccess\Annotation\SetterAccessor ;
543546
544547 class Invoice
545548 {
@@ -550,7 +553,7 @@ object:
550553 // Notice that there is no real "total" property
551554
552555 /**
553- * @PropertyGetter (property="total")
556+ * @GetterAccessor (property="total")
554557 */
555558 public function getTotal()
556559 {
@@ -559,7 +562,7 @@ object:
559562
560563 // Notice that 'property' can be omitted in the parameter
561564 /**
562- * @PropertySetter ("total")
565+ * @SetterAccessor ("total")
563566 *
564567 * @param mixed $total
565568 */
0 commit comments