加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 实时通知UML类图

发布时间:2020-12-13 13:42:33 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试实施一个实时通知系统(如fb,xing,twitter ..).因此,我在构建实体之前创建了一个UML类图.展示如下: 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 E
我正在尝试实施一个实时通知系统(如fb,xing,twitter ..).因此,我在构建实体之前创建了一个UML类图.展示如下:

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”类来存储此新实体的通知.

这种方式是好还是完全搞砸了?请告诉我你关于这个图的想法:

(建立关联的箭头应该是正常的线,我使用的工具不能这样做).

只是一些观察:

>两个抽象类似乎是多余的,因为您只在一个上下文中使用它们.>用户的连接应该转到UserEndNotification,而不是抽象类(我建议丢弃它).>我会使NotificationType成为<<枚举>>>而不是使用自己的关系我将使用User和Event之间的关联类,并添加一个isOwner和isSubscriber属性.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读