@@ -472,19 +472,19 @@ Then, using the overriden methods is automatic:
472
472
// will return 'Hello John Doe'
473
473
474
474
You can also associate a particular method with an operation on a property
475
- using the `@Getter `, `@Setter `, `@Adder ` and ` @Remover ` annotations. All of them
476
- take only one parameter: `property `.
475
+ using the `@PropertyGetter `, `@PropertySetter `, `@PropertyAdder ` and
476
+ ` @PropertyRemover ` annotations. All of them take only one parameter: `property `.
477
477
478
478
This allows creating virtual properties that are not directly stored in the
479
- object::
479
+ object:
480
480
481
481
.. configuration-block ::
482
482
483
483
.. code-block :: php
484
484
485
485
// ...
486
- use Symfony\Component\PropertyAccess\Annotation\Getter ;
487
- use Symfony\Component\PropertyAccess\Annotation\Setter ;
486
+ use Symfony\Component\PropertyAccess\Annotation\PropertyGetter ;
487
+ use Symfony\Component\PropertyAccess\Annotation\PropertySetter ;
488
488
489
489
class Invoice
490
490
{
@@ -495,15 +495,16 @@ object::
495
495
// Notice that there is no real "total" property
496
496
497
497
/**
498
- * @Getter (property="total")
498
+ * @PropertyGetter (property="total")
499
499
*/
500
500
public function getTotal()
501
501
{
502
502
return $this->quantity * $this->pricePerUnit;
503
503
}
504
504
505
+ // Notice that 'property' can be omitted in the parameter
505
506
/**
506
- * @Setter(property= "total")
507
+ * @PropertySetter( "total")
507
508
*
508
509
* @param mixed $total
509
510
*/
0 commit comments