[TYPO3-mvc] MM relation

Alexander Dick alex at dick.at
Tue Oct 19 19:26:53 CEST 2010


Never mind, this maxitems I was referring to is outside of the 'config' array, so it has no influence at all. 

I think the problem lies in your Model.

The corresponding property has to be declared as a Tx_Extbase_Persistence_ObjectStorage: 

/**
 * @var Tx_Extbase_Persistence_ObjectStorage<Tx_myarticles_Domain_Model_Category>
 */
protected $categories;


Do you have that?


On Tue, 19 Oct 2010 19:09:24 +0200, Dawid Pacholczyk <dpacholczyk at gmail.com> wrote:
> Thanks Stefan. It`s almoust ok.
> 
> I`ve connected Article with Category with assiociaton connection.
> Kickstarter created mm table. So it`s cool. But when I use select filed
> and
> I select 2 records nothing happens. Nothing is written in mm table. This
> is
> my TCA for this field
> 
> 'category' => array(
>             'exclude' => 0,
>             'label'   =>
> 'LLL:EXT:my_articles/Resources/Private/Language/locallang_db.xml:tx_myarticles_domain_model_article.category',
>             'config' => Array (
>                 'type' => 'select',
>                 'size' => 5,
>                 'treeView' => 1,
>                 'foreign_table' => 'tx_myarticles_domain_model_category',
>                 'autoSizeMax' => 50,
>                 'minitems' => $confArr['requireCategories'] ? 1 : 0,
>                 'maxitems' => 500,
>                 'MM' => 'tx_myarticles_article_category_mm',
>             ),
>                 'size' => 1,
>                 'maxitems' => 1,
>                 'eval' => ''
>         ),
> 
> 2010/10/19 Stefan Isak <stefanisak at googlemail.com>
> 
>> Alright.
>> Then you just have to create two objects and name it "Article" and
>> "Category".
>> Relate it to each other using relation type association table.
>>
>> That should do it. Everything else gets generate automatically.
>>
>> 2010/10/19 Dawid Pacholczyk <dpacholczyk at gmail.com>
>>
>> > Yes I`m using extbase_kickstarter. I`m creating relations from
>> >
>> >  tx_myext_domain_model_article to  tx_myext_art_cat_mm 1 to many and
> from
>> > tx_myext_domain_model_category to  tx_myext_art_cat_mm one to many
>> >
>> > But now I`m wondering. Shoud I careate  tx_myext_art_cat_mm manualy by
>> > writing it in ext_tables.php and ext_tables.sql or with
>> extbase_kickstarter
>> > ?
>> >
>> > Best regards,
>> > Dawid
>> >
>> > 2010/10/19 Stefan Isak <stefanisak at googlemail.com>
>> >
>> > > Or less confusing and better to talk about:
>> > >  tx_myext_domain_model_article
>> > >  tx_myext_domain_model_category
>> > >  tx_myext_article_category_mm
>> > >
>> > > That are even more meaningful names for domain objects.
>> > >
>> > > 2010/10/19 Stefan Isak <stefanisak at googlemail.com>
>> > >
>> > > > Do you make use of extbase_kickstarter?
>> > > >
>> > > > Be aware of conventions. Your tables should look like:
>> > > >   tx_myext_domain_model_art
>> > > >   tx_myext_domain_model_cat
>> > > >   tx_myext_art_cat_mm
>> > > >
>> > > > Cheers
>> > > > Stefan
>> > > >
>> > > > 2010/10/19 Dawid Pacholczyk <dpacholczyk at gmail.com>
>> > > >
>> > > >> I just want to add that I`m asking here cause in old school
>> > > >> ext/kickstarter
>> > > >> I could click "true m-m relation". How can I achive it here ?
>> > > >>
>> > > >> 2010/10/19 Dawid Pacholczyk <dpacholczyk at gmail.com>
>> > > >>
>> > > >> > I would like to create a MM relation.
>> > > >> >
>> > > >> > I have categories. (table and model is created) and I have
> article
>> > > >> (table
>> > > >> > and model is created)
>> > > >> >
>> > > >> > Normalny I would create table "artcat_mm" and make 1-to-many
>> > relations
>> > > >> from
>> > > >> > category and article table so I did that. I`ve changed TCA
>> > > configuration
>> > > >> of
>> > > >> > Article and made there a select box with categories. I can
> select
>> > them
>> > > >> (2
>> > > >> > or
>> > > >> > 3 or how much I want) but how can I say TYPO3 to write records
> in
>> > > >> artcat_mm
>> > > >> > ??
>> > > >> >
>> > > >> > Best regards,
>> > > >> > Dawid Pacholczyk
>> > > >> >
>> > > >> > --
>> > > >> > Dawid Pacholczyk
>> > > >> > tel: 502-054-334
>> > > >> > gg: 5564051
>> > > >> > skype: dpacholczyk
>> > > >> > http://typo3blog.pl (only polish version at the moment)
>> > > >> > _______________________________________________
>> > > >> > TYPO3-project-typo3v4mvc mailing list
>> > > >> > TYPO3-project-typo3v4mvc at lists.typo3.org
>> > > >> >
>> > > >>
>> > >
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>> > > >> >
>> > > >>
>> > > >>
>> > > >>
>> > > >> --
>> > > >> Dawid Pacholczyk
>> > > >> tel: 502-054-334
>> > > >> gg: 5564051
>> > > >> skype: dpacholczyk
>> > > >> http://typo3blog.pl (only polish version at the moment)
>> > > >> _______________________________________________
>> > > >> TYPO3-project-typo3v4mvc mailing list
>> > > >> TYPO3-project-typo3v4mvc at lists.typo3.org
>> > > >>
>> > >
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>> > > >>
>> > > >
>> > > >
>> > > _______________________________________________
>> > > TYPO3-project-typo3v4mvc mailing list
>> > > TYPO3-project-typo3v4mvc at lists.typo3.org
>> > >
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>> > >
>> >
>> >
>> >
>> > --
>> > Dawid Pacholczyk
>> > tel: 502-054-334
>> > gg: 5564051
>> > skype: dpacholczyk
>> > http://typo3blog.pl (only polish version at the moment)
>> > _______________________________________________
>> > TYPO3-project-typo3v4mvc mailing list
>> > TYPO3-project-typo3v4mvc at lists.typo3.org
>> >
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>> >
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>
> 
> 
> 
> --
> Dawid Pacholczyk
> tel: 502-054-334
> gg: 5564051
> skype: dpacholczyk
> http://typo3blog.pl (only polish version at the moment)
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list