建模人员/公司角色

发布于 2024-11-06 00:24:46 字数 1651 浏览 0 评论 0原文

我一直在从事一个处理家庭维护服务工作的项目,但我很难对不同的人和公司所扮演的角色进行建模。如果重要的话,系统是使用 zendFramework 编写的,并使用 mySql 作为数据存储。

我会尽力解释,但我不太精通数据建模语言。
该系统的最终用户是一家维护公司,我在下面的示例中将其称为HammerTime。这是我到目前为止所得到的:

WorkOrderRequests 来自两个主要来源: 来源 1:Resident>>requestWorkOrder>>PropertyManagementCompany>>requestWorkOrder>>HammerTime

来源 2:HomeOwner >>requestWorkOrder>>HammerTime

我将所有这些实体视为客户,但只有 PropertyManagementCompaniesHomeOwners 是客户将收到发票的“直接”客户。此外,如果居民拥有自己居住的房产,他们也可以成为HomeOwner。此外,为了在此基础上添加另一层业务逻辑,所有居民都属于 财产以及从居民PropertyManagementCompany提出的所有请求均由PropertyManager调解

工作订单请求到来时, 在 HammerTime 中,它们被存储为 WorkOrders,然后以几种不同的方式进行处理。

处理 1:HammerTime>>assignWorkOrder>>Employee

处理 2:HammerTime>>contractOutWorkOrder>>ServiceVendor

我认为这些实体是工人,他们似乎更容易建模。

问题是我希望能够根据所有这些实体的角色类型向系统授予对它们的访问权限。在我看来,我想将它们全部分组在一个 Member 抽象超类下,该超类可以由另外两个抽象类 PersonCompany 子类化。 那么 PersonCompany 可以进一步由更具体的类(如 EmployeePropertyManagementCompany 等)进行子类化

财产适合,因为它不是个人或公司。我想也许会是一个会员

我有一种感觉,我完全错过了一些东西,因为有些东西感觉不对劲。因此,任何想法或指示将不胜感激。

Ive been working on a project which handles jobs for a home maintenance service, but Im having a difficult time modeling the roles that different people and companies play. If it matters the system is written using zendFramework, with mySql as the data storage.

Ill do my best to explain but I am not to well versed in the language of data modeling.
the end user of this system is a Maintenance Company I will call HammerTime in the following examples. This is what I have so far:

WorkOrderRequests come in from two primary sources:
Source 1: Resident>>requestWorkOrder>>PropertyManagementCompany>>requestWorkOrder>>HammerTime

Source 2: HomeOwner>>requestWorkOrder>>HammerTime

I think of all of these entities as customers, but only PropertyManagementCompanies and HomeOwners are "direct" customers which will receive invoices. Also a resident can be a HomeOwner if they own the property they reside in. Also to add another layer of business logic on top this, all Residents belong to a Property and all requests from a Resident to a PropertyManagementCompany are mediated by a PropertyManager

When WorkOrderRequests come in to HammerTime they are stored as WorkOrders and then are handled in a few different ways.

Handled 1: HammerTime>>assignWorkOrder>>Employee

Handled 2: HammerTime>>contractOutWorkOrder>>ServiceVendor

I think of these entities as the workers and they seem to be easier to model.

The problem is that the I would like to be able to grant access to all of these entities to the system based on their role types. In my mind I would like to group them all under a Member abstract superclass which could be subclassed by two more abstract classes Person and Company.
then the Person and Company could further be subclassed by more concrete classes like Employee or PropertyManagementCompany etc..

Where would a Property fit in as it is not a person or a company. I guess maybe it would be a Member

I have a feeling I am completely missing something as something just doesnt feel right. So any ideas, or pointers would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声无音无过去 2024-11-13 00:24:46

我根本不懂 php 或 Zend,但您可能想看看“Party-Role”模式。 (只需谷歌,参见例如(1)(2)(3))。

在您的场景中 Person &组织是政党的子类型。 Employee、ServiceVendor、Resident等都是Role的子类型。 Party 和 Party 之间存在多对多的关系。角色。您可以根据需要定义角色子类型之间的关系。分配权限应该变得很容易;每个参与方都获得其分配到的每个角色的权限。

嗯。

I don't know php or Zend at all, but you might want to look at the "Party-Role" Pattern. (Just google, see e.g. (1)(2)(3)).

In your scenario Person & Organisation are subtypes of Party. Employee, ServiceVendor, Resident, etc. are all subtypes of Role. There's a many:many relationship among Party & Role. You can define relationships as required among role subtypes. Assigning permissions should then become easy; each Party gains permissions for each role it is assigned to.

hth.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文