[TYPO3-mvc] help to n:m relation

Ismaël Bidau bidau at ensci.com
Thu Feb 24 08:36:13 CET 2011


Le 23/02/11 17:11, Franz Koch a écrit :
> Hey,
>
>>> what should be the result of this? Using IRRE like that doens't mean to
>>> use a intermediate (MM) table.
>>
>> i want to use an intermediate table to store start and end dates (this
>> student is in this university from 10-01-2010 to 08-31-2011 and in
>> another one from 09-01-2011 to 08-31-2012)
>
> ok - then you most likely don't just want to misuse a intermediate
> table, but need a intermediate object.
>
>>> Maybe you could explain how it's supposed to work and then I can tell
>>> you which adjustments you have to take.
>>
>> In Frontend, i want to have a form like this :
>>
>> you name :
>> ...
>> your studies
>> university1 : from : to :
>> university2 : from : to :
>>
>> I know how to store the name (in table tx_student_list), I know how to
>> create a selectbox with a list of universities (from table
>> tx_university_list)) but I don't know how to save in the third table
>> (tx_student_university with fields uid_local for uid_student,
>> uid_foreign for uid_university, start, end)
>
> As I said - in my eyes you need a intermediate object, probably like this:
>
> Student
> -> name
> -> address
> -> memberships <Membership>
>
> Membership
> -> university <University>
> -> from
> -> to
> -> student <Student>
>
> University
> -> name
> -> memberships <Membership>
>
>
> Membership might not be the best name, but I think you get the point.
> Having this structure you configure "memberships" to use IRRE setting
> the correct 'foreign_field' from each side of the relation (Student and
> University) and that's it.
>

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>"?

Ismaël BIDAU


More information about the TYPO3-project-typo3v4mvc mailing list