GetSetObject.php 921 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation\AccessType;
  4. use JMS\Serializer\Annotation\Exclude;
  5. use JMS\Serializer\Annotation\ReadOnly;
  6. use JMS\Serializer\Annotation\Type;
  7. /** @AccessType("public_method") */
  8. class GetSetObject
  9. {
  10. /** @AccessType("property") @Type("integer") */
  11. private $id = 1;
  12. /** @Type("string") */
  13. private $name = 'Foo';
  14. /**
  15. * @ReadOnly
  16. */
  17. private $readOnlyProperty = 42;
  18. /**
  19. * This property should be exlcluded
  20. * @Exclude()
  21. */
  22. private $excludedProperty;
  23. public function getId()
  24. {
  25. throw new \RuntimeException('This should not be called.');
  26. }
  27. public function getName()
  28. {
  29. return 'Johannes';
  30. }
  31. public function setName($name)
  32. {
  33. $this->name = $name;
  34. }
  35. public function getReadOnlyProperty()
  36. {
  37. return $this->readOnlyProperty;
  38. }
  39. }