Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TYPO3 TCA select, NULL value in items array

I have made an extension in Typo3 4.5 with extbase and fluid. Now to insert some data i use the backend module 'list' that makes some forms with the TCA of the tables. To make a select box optional, I insert an item before the foreign table like this:

    'feuser' => array(
        'exclude' => 0,
        'label' => 'LLL:EXT:yes/Resources/Private/Language/locallang_db.xml:tx_yes_domain_model_schools.feuser',
        'config' => array(
            'type' => 'select',
            'items' => array(
                array('', NULL),
            ),
            'foreign_table' => 'fe_users',
            'maxitems' => 1,
        ),
    ),

Now, since i have a relation (with NULL alowed) in my DB, i have to insert a NULL value. But like this it doesn't work. I have also tried '', "" and 0. But those don't work either.

I would appreciate any help.

like image 272
Agash Thamo. Avatar asked Apr 10 '13 07:04

Agash Thamo.


1 Answers

Try this:

'items' => array(
    array('', -1))

The second parameter in the array is not the value for the db!

like image 162
Wipster Avatar answered Oct 27 '22 16:10

Wipster