I\'m trying to serialize a entity relation with JMS Serializer.
Here is the Entity:
class Ad
{
/**
* @Type(\"string\")
* @Groups({\"manag
Yes, you could use @VirtualProperty
annotation:
/**
* @VirtualProperty
* @SerializedName("foo")
*/
public function bar()
{
return $this->country->getCode();
}
But be aware when it comes to deserialization:
@VirtualProperty This annotation can be defined on a method to indicate that the data returned by the method should appear like a property of the object.
> Note: This only works for serialization and is completely ignored during deserialization.
Hope this helps...