Monday 15 June 2015

symfony2 - JMS Serializer: Dynamically change the name of a virtual property at run time -



symfony2 - JMS Serializer: Dynamically change the name of a virtual property at run time -

i utilize jms serializer bundle , symfony2. using virtualproperties. currently, set name of property using serializedname annotation.

/** * @jms\virtualproperty() * @jms\serializedname("some_name") */ public function getsomething() { homecoming $this->something }

is possible set serialized name dynamically within function? or possible dynamically influence name using post/pre serialization events?

thanks!

i don't think can directly, accomplish similar having several virtual properties, 1 each possible name. if name not relevant particular entity, have method homecoming null, , disable null serialization in jms config.

symfony2 jmsserializerbundle jms-serializer

No comments:

Post a Comment