Virtual properties can be defined at class level. It would be great if this would be possible with accessors, too.
This would be nice for cases where your entity uses traits by third party libraries and you want to put serialization groups to a property inhertied by a trait.
Afaik one has to use YAML config file to achieve this at the moment. If you use YAML for all your entities this is no problem. But if you use annotations it is quite annoying that you have to use YAML for some entities just because of one or two inherited properties.
Example how this could look like:
/**
* @Serializer\Accessor("name", getter="getTrimmedName",setter="setName")
* @Serializer\Accessor("firstName", getter="getTrimmedFirstName",setter="setFirstName")
*/
class Author
{
use PersonTrait;
}
If you like this proposal maybe I'll implement this feature and create a PR.
@goetas Have you actually read my post completely? Virtual properties cannot be used to set values when deserializing. That's why I talked about accessors.
Virtual properties can be defined at class level. It would be great if this would be possible with accessors, too.
This would be nice for cases where your entity uses traits by third party libraries and you want to put serialization groups to a property inhertied by a trait.
Afaik one has to use YAML config file to achieve this at the moment. If you use YAML for all your entities this is no problem. But if you use annotations it is quite annoying that you have to use YAML for some entities just because of one or two inherited properties.
Example how this could look like:
If you like this proposal maybe I'll implement this feature and create a PR.