I have an Rest API built on Symfony 2.7 Framework with FOSRestBundle and JMSSerializerBundle. I have a look to yml reference and annotations.
I have choosen to define how each entity of my model is serialized with yml.
I have seen that we can serialize Datetime
object on a specific format :
@JMS\Type("DateTime<'d-m-Y'>")
But I don't know the correct syntax used with yml definition, I have tried :
my_field:
expose: true
type: datetime
format: 'd-m-Y'
And
my_field:
expose: true
type: datetime<'d-m-Y'>
I don't want to use Annotations
because I have a lot of yaml files.
But the field is not serialized...
Anyone can help me ?
I put it as an answer in case it helps more people:
my_field:
expose: true
type: DateTime<'d-m-Y'>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With