EDIT: I Thought about this approach and it seems as if this is not the right one. Let’s check the following scenarion: User U adds at Event E’s image I a comment C. How to store this correctly,I mean EventNotification only has a reference on the Event E,but not on I and C. Therefore I would need to create an “EventImageNotification” class as well and this would be a mess. Would it be a nicer solution to just have one “Notification” class and add a “Metadata” field to it,which stores references to all involved fields?
(我正在使用OR-Mapper来实现关系).
[1]一个用户可以创建事件,例如“Silvester Party 2015”. (一对多).
此事件有一个仪表板,用户可以订阅接收更新,当创建者发布事件(ManyToMany).
[2]当用户在事件的仪表板上发帖时,订阅的用户应该收到通知.所以我创建了EventNotification类.用户和EventNotification之间的关系是ManyToMany.
[3]为了保持清洁,我创建了一个与Notification类型相关的AbstractNotification类.通知类型类似于name =“EventPost”,template =“用户用户已经在事件__event上发布了新的东西”.
[4]抽象类NotificationConnector为EventNotification和User(UserEventNotification)之间的映射类提供了字段.我创建它们以便将来容易地扩展它,例如用户可以创建也触发事件等的书籍.然后,我需要创建一个“BookNotification”和一个“UserBookNotification”类来存储此新实体的通知.
这种方式是好还是完全搞砸了?请告诉我你关于这个图的想法:
(建立关联的箭头应该是正常的线,我使用的工具不能这样做).