Dynamic fields/properties in Doctrine2 - how?

2019-06-24 17:51发布

I I would like plugins to be able to add properties to my models. For example, I have a model "Message". A "Like" plugin can add property "likedtimes" to it and maintain it. How can I get such functionality?

One solution is to create a separate table and model for likes. But that would require a join or additional select whenever likes are to be displayed.

1条回答
小情绪 Triste *
2楼-- · 2019-06-24 18:35

Are you trying to replicate common functionality between Entities (not models)?

If so, I would recommend you implement your own behavior, using the built-in event system.

FYI: Difference between entities and models

查看更多
登录 后发表回答