php - DDD, ERD, ORM: has one, or belongs to one? -


I was wondering if such a thing is related to 'relationship', and what was its function, or if it Was one right 'one' near?

A question has arise when creating an ORM, and one way to determine the example of a unit should be automatically removed, such as:

in the user thread There are many 'comments' in the

thread, there is a 'user'

the comment has a thread

> Assume that you remove a user instance Please give it. Its related thread example should be intact. But if you delete a thread instance, its comments should be deleted.

With the above schema, the ORM can not tell when to withdraw and when not.

There are many comments in the thread '

thread' one 'user

The comment is related to' one 'thread

whether its it means? It is possible for ORM, but does the ERD cover this scenario?

Any thoughts?

I've seen the usual implementation, for all "related" relationships, Will be present in any "many" relationships because the child's table will be present in the foreign key

A definition shows whether one relationship from "one is" or "belongs to" foreign key Depends on the location of the area. If it is in the same table as the core model then it is in relation to a "connection" if it is in another table, then this is a "one" relationship.


Comments