简体   繁体   English

TYPO3 TCA选择,项目数组中为NULL值

[英]TYPO3 TCA select, NULL value in items array

I have made an extension in Typo3 4.5 with extbase and fluid. 我已经用extbase和fluid在Typo3 4.5中进行了扩展。 Now to insert some data i use the backend module 'list' that makes some forms with the TCA of the tables. 现在要插入一些数据,我使用后端模块“列表”,该模块使用表的TCA形成某种形式。 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. 现在,由于我在数据库中有一个关系(允许使用NULL),因此我必须插入一个NULL值。 But like this it doesn't work. 但是像这样它是行不通的。 I have also tried '', "" and 0. But those don't work either. 我也尝试过'',“”和0。但是那些也不起作用。

I would appreciate any help. 我将不胜感激任何帮助。

Try this: 尝试这个:

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

The second parameter in the array is not the value for the db! 数组中的第二个参数不是db的值!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM