GetSetObject.php 799 B

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