[TYPO3-mvc] M to M Relationship between Tables A&A, A&B, B&B, ...

Lars Peipmann [Infield Design] Lars at Peipmann.de
Wed Aug 17 00:07:58 CEST 2011


Hi there,

I developed an Extension with Extbase. It contains several Models. 2 of 
those Models should have a M to M Relationship such that:

 > Model A, Item 1 to Model A, Item 2
 > Model A, Item 2 to Model A, Item 1

 > Model B, Item 1 to Model B, Item 2
 > Model B, Item 2 to Model B, Item 1


 > Model A, Item 1 to Model B, Item 1
 > Model B, Item 1 to Model A, Item 1

 > Model A, Item 2 to Model B, Item 2
 > Model B, Item 2 to Model A, Item 2


 > Model A, Item 1 to Model B, Item 2
 > Model B, Item 2 to Model A, Item 1

 > Model A, Item 2 to Model B, Item 1
 > Model B, Item 1 to Model A, Item 2

In a short sentence: Each Item of both types can be related with each 
other Item. And the direction is important.

I would like to do this M to M Relation with one M to M Database Table. 
Is this possible with Extbase? If yes, can you explain it? What is the 
TCA Configuration for the Columns?

Is this Database schema (S#1) possible?
CREATE TABLE tx_xyz_domain_model_related (
	model_a int(11) unsigned DEFAULT '0' NOT NULL,
	model_b int(11) unsigned DEFAULT '0' NOT NULL,
	type_a varchar(255) DEFAULT '' NOT NULL,
	type_b varchar(255) DEFAULT '' NOT NULL,
);

Or this Database schema (S#2) with global unique IDs in the Model-Tables?
CREATE TABLE tx_xyz_domain_model_related (
	model_a int(11) unsigned DEFAULT '0' NOT NULL,
	model_b int(11) unsigned DEFAULT '0' NOT NULL,
);

Best, Lars




More information about the TYPO3-project-typo3v4mvc mailing list