[TYPO3-mvc] Select-field with items-array and foreign_table

Stefan Geith typo3dev2010.nospam1 at geithware.de
Tue Jan 5 11:06:09 CET 2010


Hi Extbasers !

First of all: "A Happy New Year to All of You!"

Finally I found the time to start my first extension using extbase.
And only some hours after starting, there came up the first problem
and I could not find anything about this in this list:

Situation:
I have an article- and a categories-Table (and model).
TCA for the category-field in articles looks like this:
   'category' => array (		
     'label' => 'category',		
     'config' => array (
       'type' => 'select',	
       'items' => Array (
         Array('',0),
       ),
       'foreign_table' => 'tx_myext_domain_model_category',	
       'foreign_class' => 'Tx_MyExt_Domain_Model_Category',	
       'size' => 1,	
       'minitems' => 0,
       'maxitems' => 1,
     )
   ),

Problem:
If no item of the foreign table is selected (so the
value '0' of the items-array is used), then
I get this error:
   #1237301367: $object must be an object or an array, boolean given.
when I use
   {article.category.title}
in my template.

Question(s):
1) Are additional 'items'-Arrays basically allowed with extbase ?
2) How do I solve this problem ?
    I think, I have to create an empty category-object manually...
    But where ?
3) What, if there are even more items e.g. like in 'fe_group',
    where I have additional
       array('hide_at_login', -1),
       array('any_login', -2),
       array('usergroups', '--div--')
    items ?


Thanks in advance,
     Stefan


More information about the TYPO3-project-typo3v4mvc mailing list