AuthorReadOnlyPerClass.php 802 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation\Accessor;
  4. use JMS\Serializer\Annotation\ReadOnly;
  5. use JMS\Serializer\Annotation\SerializedName;
  6. use JMS\Serializer\Annotation\Type;
  7. use JMS\Serializer\Annotation\XmlRoot;
  8. /**
  9. * @XmlRoot("author")
  10. * @ReadOnly
  11. */
  12. class AuthorReadOnlyPerClass
  13. {
  14. /**
  15. * @ReadOnly
  16. * @SerializedName("id")
  17. */
  18. private $id;
  19. /**
  20. * @Type("string")
  21. * @SerializedName("full_name")
  22. * @Accessor("getName")
  23. * @ReadOnly(false)
  24. */
  25. private $name;
  26. public function __construct($id, $name)
  27. {
  28. $this->id = $id;
  29. $this->name = $name;
  30. }
  31. public function getId()
  32. {
  33. return $this->id;
  34. }
  35. public function getName()
  36. {
  37. return $this->name;
  38. }
  39. }