[TYPO3-mvc] Kickstarter - Relations - association_table VS foreign_key

Jochen Rau jochen.rau at typoplanet.de
Thu Dec 17 21:15:23 CET 2009


Hi.

schrieb David Schreiber:
> What is the difference between the 0...* options 'association_table' or
> 'foreign_key'.
>
> Do I assume right that foreign_key is a simple 1-n relation, whereas
> association_table is used to create m-n relations ?

Yes, you are right.

Currently the selectable types of relation in the kickstarter are:

0 .. 1
0 .. * (foreign Key)
0 .. * (association table)

This is not the final solution as it does not reflect the mindset of 
Domain-Driven Development (where there are no association tables ;-) ). 
There are many different way to express relations I always mix up. The 
one shown above is taken from UML class diagram and denotes how many 
elements are allowed on _one_ side of a relation (in this case the child 
side of a parent-child relation). Another denotation shows both sides of 
the relation:

1--1
1--n
m--n

The right side is the equivalent of the first one (0 .. 1 == 1, and 0 .. 
* == n).

I like the following (as they are used as constants in Extbase internally):

has_one
has_many
has_and_belongs_to_many

where the last case should better be named "has many and the child 
belogs to many" (but ist is already too long).

Any suggestions what to take for the Kickstarter?

Regards
Jochen


--
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list