AuthorExpressionAccess.php 807 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation as Serializer;
  4. /**
  5. * @Serializer\VirtualProperty("firstName", exp="object.getFirstName()", options={@Serializer\SerializedName("my_first_name")})
  6. */
  7. class AuthorExpressionAccess
  8. {
  9. private $id;
  10. /**
  11. * @Serializer\Exclude()
  12. */
  13. private $firstName;
  14. /**
  15. * @Serializer\Exclude()
  16. */
  17. private $lastName;
  18. public function __construct($id, $firstName, $lastName)
  19. {
  20. $this->id = $id;
  21. $this->firstName = $firstName;
  22. $this->lastName = $lastName;
  23. }
  24. public function getFirstName()
  25. {
  26. return $this->firstName;
  27. }
  28. /**
  29. * @Serializer\VirtualProperty()
  30. */
  31. public function getLastName()
  32. {
  33. return $this->lastName;
  34. }
  35. }