AuthorReadOnly.php 753 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /** @XmlRoot("author") */
  9. class AuthorReadOnly
  10. {
  11. /**
  12. * @ReadOnly
  13. * @SerializedName("id")
  14. */
  15. private $id;
  16. /**
  17. * @Type("string")
  18. * @SerializedName("full_name")
  19. * @Accessor("getName")
  20. */
  21. private $name;
  22. public function __construct($id, $name)
  23. {
  24. $this->id = $id;
  25. $this->name = $name;
  26. }
  27. public function getId()
  28. {
  29. return $this->id;
  30. }
  31. public function getName()
  32. {
  33. return $this->name;
  34. }
  35. }