[TYPO3-mvc] help to n:m relation

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Feb 24 13:27:25 CET 2011


Hey,

> If I understand, I need a Model/Repository for Membership table, right ?
> Where can I found a working exemple of three tables relation with
> extbase (to understand how to write getter/setter for "-> memberships
> <Membership>"?

You don't necessarily need a repository for the "memberships" unless you 
like to query those directly. But you definitely need a database table, 
TCA settings and a domain model for the memberships.

And it's no three table relation here - just nested objects having n:m 
relations.

University n:m memberships m:n Student


So your TCA would look like this:

-- Student ---
field: memberships
   'type' => 'inline',
   'foreing_table' => 'tx_yourext_domain_model_membership',
   'foreign_field' => 'student'

-- University ---
field: memberships
   'type' => 'inline',
   'foreing_table' => 'tx_yourext_domain_model_membership',
   'foreign_field' => 'university'

-- memberships ---
field: student
   'type' => 'select',
   'foreing_table' => 'tx_yourext_domain_model_student',
   'size' => 1,
   'maxitems' => 1

field: university
   'type' => 'select',
   'foreing_table' => 'tx_yourext_domain_model_university',
   'size' => 1,
   'maxitems' => 1


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list