PersonSecretVirtual.php 712 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation as Serializer;
  4. /**
  5. * @Serializer\ExclusionPolicy("NONE")
  6. * @Serializer\AccessorOrder("custom",custom = {"name", "gender", "age"})
  7. */
  8. class PersonSecretVirtual
  9. {
  10. /**
  11. * @Serializer\Type("string")
  12. */
  13. public $name;
  14. /**
  15. * @Serializer\Exclude()
  16. */
  17. public $gender;
  18. /**
  19. * @Serializer\Type("string")
  20. * @Serializer\Expose(if="show_data('age')")
  21. */
  22. public $age;
  23. /**
  24. * @Serializer\VirtualProperty()
  25. * @Serializer\Type("string")
  26. * @Serializer\Exclude(if="show_data('gender')")
  27. */
  28. public function getGender()
  29. {
  30. return $this->gender;
  31. }
  32. }