Skip to content

Commit 27e2d02

Browse files
committed
Added 'Property' prefix to method annotations
1 parent 94ca7d5 commit 27e2d02

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

components/property_access.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,19 +525,19 @@ Then, using the overriden methods is automatic:
525525
// will return 'Hello John Doe'
526526
527527
You can also associate a particular method with an operation on a property
528-
using the `@Getter`, `@Setter`, `@Adder` and `@Remover` annotations. All of them
529-
take only one parameter: `property`.
528+
using the `@PropertyGetter`, `@PropertySetter`, `@PropertyAdder` and
529+
`@PropertyRemover` annotations. All of them take only one parameter: `property`.
530530

531531
This allows creating virtual properties that are not directly stored in the
532-
object::
532+
object:
533533

534534
.. configuration-block::
535535

536536
.. code-block:: php
537537
538538
// ...
539-
use Symfony\Component\PropertyAccess\Annotation\Getter;
540-
use Symfony\Component\PropertyAccess\Annotation\Setter;
539+
use Symfony\Component\PropertyAccess\Annotation\PropertyGetter;
540+
use Symfony\Component\PropertyAccess\Annotation\PropertySetter;
541541
542542
class Invoice
543543
{
@@ -548,15 +548,16 @@ object::
548548
// Notice that there is no real "total" property
549549
550550
/**
551-
* @Getter(property="total")
551+
* @PropertyGetter(property="total")
552552
*/
553553
public function getTotal()
554554
{
555555
return $this->quantity * $this->pricePerUnit;
556556
}
557557
558+
// Notice that 'property' can be omitted in the parameter
558559
/**
559-
* @Setter(property="total")
560+
* @PropertySetter("total")
560561
*
561562
* @param mixed $total
562563
*/

0 commit comments

Comments
 (0)