123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace JMS\Serializer\Tests\Fixtures;
- use JMS\Serializer\Annotation\AccessorOrder;
- use JMS\Serializer\Annotation\SerializedName;
- use JMS\Serializer\Annotation\Type;
- use JMS\Serializer\Annotation\VirtualProperty;
- use JMS\Serializer\Annotation\SkipWhenEmpty;
- /**
- * @AccessorOrder("custom", custom = {"prop_name", "existField", "foo" })
- */
- class ObjectWithVirtualProperties
- {
- /**
- * @Type("string")
- */
- protected $existField = 'value';
- /**
- *
- * @VirtualProperty
- */
- public function getVirtualValue()
- {
- return 'value';
- }
- /**
- * @VirtualProperty
- * @SerializedName("test")
- */
- public function getVirtualSerializedValue()
- {
- return 'other-name';
- }
- /**
- * @VirtualProperty
- * @Type("integer")
- */
- public function getTypedVirtualProperty()
- {
- return '1';
- }
- /**
- * @VirtualProperty
- * @SkipWhenEmpty()
- */
- public function getEmptyArray()
- {
- return [];
- }
- }
|