You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently looking for a way to add properties to a serialized object depending on some computation done by a service in my application.
The only way I see to do that is to use a SerializerListener and, when to serialized object has the correct class, add the data.
If you have to do that for only one or two classes, fine, but if it is not the case, you will have to add a lot of different listeners that will be called for each serialized object (if I am not mistaken).
The other way I see that, is by using a virtual property, but if the computation is done by a service, the only way to have this working is to inject the service in my doctrine entity which is quite ugly too...
I was wondering if it was possible to add some parameters to the VirtualProperty annotation (property name + service name + method name) to be able to use a service to get the value of a virtual property of a class.
What do you think about that?
If this feature is interesting you, I can try to implement it (i'll eventually need some advice on what to do to have it work correctly).
EDIT: i just submitted that and noticed that it is more about the serializerbundle than the serializer component itself :S
The text was updated successfully, but these errors were encountered:
Hi.
I am currently looking for a way to add properties to a serialized object depending on some computation done by a service in my application.
The only way I see to do that is to use a SerializerListener and, when to serialized object has the correct class, add the data.
If you have to do that for only one or two classes, fine, but if it is not the case, you will have to add a lot of different listeners that will be called for each serialized object (if I am not mistaken).
The other way I see that, is by using a virtual property, but if the computation is done by a service, the only way to have this working is to inject the service in my doctrine entity which is quite ugly too...
I was wondering if it was possible to add some parameters to the VirtualProperty annotation (property name + service name + method name) to be able to use a service to get the value of a virtual property of a class.
What do you think about that?
If this feature is interesting you, I can try to implement it (i'll eventually need some advice on what to do to have it work correctly).
EDIT: i just submitted that and noticed that it is more about the serializerbundle than the serializer component itself :S
The text was updated successfully, but these errors were encountered: