[TYPO3-mvc] mm relation with attributes

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Jun 10 19:32:51 CEST 2011


Hey Christian,

> Now I want to have a form for each company where you can assign the
> percentages of special fields:
>
> Special fields for My Company
>
> Hardware: ..... %
> Software: ..... %
> Whatever: ..... %
>
> How do I do that? Should I create a specialfieldPercentage child object
> for every special field on creation of the company and fill the
> percentage with 0? Or should I just use normal input fields not bound to
> objects and then in the controller look for percentage objects that are
> already there?
>
> Can anyone please point me in the right direction? Any hint is greatly
> appreciated!

If your "mm-table" has some additional properties, you most likely can 
also give the relation a name and thus convert it to a real object 
rather then a "hidden" intermediate table. And by converting it to a 
real object you can easily deal with in forms etc.
So your domain structure would in the end look somewhat like this:

SpecialField <-> FieldOfActivity <-> Company


The "FieldOfActivity" object would have at least these three properties:
- specialField
- company
- percentageOfInterest
- ...


Your "Company" and "SpecialField" objects should use a IRRE relation 
with "foreign_field" configured for the fieldOfActivity table. The 
FieldOfActivity object could either have a select box or a group field 
(whatever you prefer) for company and specialField.

That's at least how I would solve it and what makes most sense to me.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list