Bug #74462

Setting a field to null in an own extension won work with process_datamap()

Added by Klaus Hinum about 3 years ago. Updated about 1 year ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2016-03-07
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Setting eval=null in tca.php of the extension now works in the Typo3 forms, but how can I change or set a value to NULL in my own extension.
Using
$this->tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$this->tce->start($data,$cmd,$new_BE_USER);
$this->tce->process_cmdmap();
$this->tce->process_datamap();

where I got a "field" => null in the $data array wont work (sets the field to 0).

Currently I am manually deleting the value with an UPDATE statement, but thats not how its meant to be I guess. Looks like old code from the area before NULL was possible in number fields.

History

#1 Updated by Nicole Cordes about 3 years ago

  • Status changed from New to Needs Feedback

Hi Klaus,

I'm not sure if I fully understand your problem. Can you please explain again

a) What are you trying to archive
b) How do you try it?
c) What happens instead?

Thank you for your help!

#2 Updated by Klaus Hinum about 3 years ago

I am trying to e.g. write NULL in a database field. The problem is, if I set a variable to NULL and write it to the database using process_datamap(); it is set to 0 altough NULL is allowed and possible in the typo3 backend. I guess there is a separate function to write NULL to the field, but I dont know why NULL and 0 are not differentiated by tce->... functions.
This should cover a) and c), how I try it is the code piece above with $data e.g. set to $data['field'] = null;

#3 Updated by Riccardo De Contardi almost 3 years ago

  • Status changed from Needs Feedback to New

#4 Updated by Susanne Moog about 1 year ago

  • Category set to DataHandler aka TCEmain

Also available in: Atom PDF