[TYPO3-dev] DDD: modelling question and how to search in model
Gerhard Mehsel
sparking at gmx.net
Sun Apr 8 21:03:28 CEST 2012
Hello,
I want to create a extbase extension that deals with persons. I try to
use DDD and the main entity should be PERSON. It's hard for me to
calculate the position. Later I want to do things like searching in the
model or call controller actions via ajax to update only parts of the
model without sending the complete model within one big HTML form.
A person has properties like prename, lastname, ... and it has some
addresses (value objects):
- a private address
- a company address
- some addresses for delivery purposes
What is the best way to model a proper relation between the entities?
Should I create direct relations to ADDRESS entities in PERSON entity
PERSON --- ADDRESS, 1:1 Relation, privateAddress
| |
| ADDRESS, 1:1 Relation, companyAddress
|
ADDRESS, 1:n Relation, deliveryAddresses
or is it better to provide a "container" entity for ADDRESSes? I think
ADDRESSCONTAINER should be an entity then, should it be an aggregate
root also?
PERSON
|
|
ADDRESSCONTAINER --- ADDRESS, 1:1 Relation, privateAddress
| |
| ADDRESS, 1:1 Relation, companyAddress
|
ADDRESS, 1:n Relation, deliveryAddresses
or something like this
PERSON
|
|
ADDRESS, 1:n Relation to PERSON, allAddresses
|
|
ADDRESSTYPE, n:1 Relation to ADDRESS, to specify private, company,
delivery addresses
How would you model this situation? Is there a sample for modelling
something like this (a little bit more complex than blog_example)
BTW: Is there a best practice to search in entites (including related
entities/value objects)?
Regards,
Gerd
More information about the TYPO3-dev
mailing list