Project

General

Profile

Actions

Bug #76701

open

Not possible to insert NULL value with TCA type 'select'

Added by Viktor Livakivskyi almost 8 years ago. Updated about 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2016-06-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hi,

I want a possibility to insert NULL via BE into a field of type "select".

My TCA definition is follwoing:

'industry' => [
    'exclude' => 0,
    'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_db.xlf:fe_users.industry',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'foreign_table' => 'tx_myext_domain_model_industry',
        'minitems' => 0,
        'items' => [
            ['', null],
        ]
    ]
],

ext_tables.sql:
industry int(11) unsigned default NULL,

The problem is, that whenever an empty value from "industry" is sent to a server it is translated into following query:
UPDATE fe_users SET industry='',tstamp='1465920150' WHERE uid=2;
And due to disabled "strict mode" it translates to 0 by MySQL.

Also tried to set '-1' as drop-down option value, but result is the same.

I guess, it should be some fields processor, which explicitly sets NULL for fields, which desire it.

Actions

Also available in: Atom PDF