Hello,
The actual behavior of the serializer is to put virtual property on top of the resulting serialized string, but ...
Shouldn't be a way to set the accessor order like : "properties first, virtual property after ?"
I know it's possible to set this order with the @AccessorOrder property, but I think it could be easier.
Maybe I'm missing a feature of this bundle?
Regards,
if the order of properties is what you need, then @AccessorOrder does exactly what you need
i no this is clossed...but @goetas how would i be able to use accessOrder in yaml
---
Appbundle\Class\Foo:
exclusion_policy: ALL
properties:
id:
expose: true
type: string
name:
expose: true
type: string
i want name to come before ID...i could only see examples online to do this inline within the model class...any ideas
Vendor\MyBundle\Model\ClassName:
accessor_order: custom
custom_accessor_order: [propertyName1, propertyName2, ..., propertyNameN]
see https://jmsyst.com/libs/serializer/master/reference/yml_reference
Most helpful comment
see https://jmsyst.com/libs/serializer/master/reference/yml_reference