[TYPO3-mvc] mmm-relationship

Barbara Schwarz barbara at web-essentials.asia
Tue Jun 8 11:18:10 CEST 2010


Hi there

Yes, the solution with the "producer" field in the product class does 
not fit my project's needs because a product can have many producers (as 
strange as it sounds, it's true). And the set of possible roles should 
be dynamic too.

So, your second solution is actually what I want, but when you think 
about the table of the "WhatEverNameFitsInHere" object, it would be 
something like a mmm table (which do not exist).

I am trying now to implement the tree-way relationship with two way 
relationships (something like Nils also proposed), but I'm curios how 
easy it is to configure the weak entities and relationships afterwards. 
Also how to configure the TCA to make the entering of records in BE as 
user friendly as possible.

I'll write again when I have some results and conclusions (and maybe new 
, more detailed questions).

Thanks a lot for all your ideas guys!

Barbara



Franz Koch wrote:
> Hey,
> 
>> I am having a hard time thinking of a proper way to implement a
>> three-way relationship (mmm-relationship?). Here's the concrete case: in
>> my data model I have a relationship between a company, product and role.
>> For example: a company can be a producer and the distributor of a
>> certain product (producer and distributor are roles). I would need to
>> make something like a table company_product_role_mmm, but this exists
>> only for the relationship between two entities, not three. Do you have
>> any idea how to implement this?
> 
> I'd actually skip the "producer" role and assign it directly to the 
> product:
> 
> Tx_YourExt_Domain_Model_Product {
>     /**
>      * @var Tx_YourExt_Domain_Model_Company
>      */
>     protected $producer
> }
> 
> 
> If that doesn't fit your domain, use a intermediate object to store the 
> needed information there:
> 
> Product -> WhatEverNameFitsInHere <- Company
> 
> Tx_YourExt_Domain_Model_WhatEverNameFitsInHere {
>     protected $product;
>     protected $company;
>     protected $role;
> }
> 
> 
> "WhatEverNameFitsInHere" should of course get replaced by a name that 
> suits your domain :)
> 


More information about the TYPO3-project-typo3v4mvc mailing list