[TYPO3-mvc] mmm-relationship

Jochen Rau jochen.rau at typoplanet.de
Mon Jun 14 10:52:49 CEST 2010


Hi Barbara.

On 2010-06-14, Barbara Schwarz <barbara at web-essentials.asia> wrote:
> I have defined a new entity and table "partner" which has two foreign 
> keys: a company_uid and role_uid. With each product I can associate many 
> partners. It should not be possible to create two partners with the same 
> pair company_uid, role_uid. In order to enforce that, I have defined the 
> pair (company_uid, role_uid) as UNIQUE.

The constraint that a company cant't be assigned to a product having the same role is clearly domain logic. I suggest not to move domain logic in the technical implementation of the database (UNIQUE). This logic can be implemented as a Validator for the Partner class. See BlogExample for an -- ehrm -- example. 

Regards
Jochen




More information about the TYPO3-project-typo3v4mvc mailing list