Project

General

Profile

Actions

Bug #103641

closed

Not possible so set nullable relation values in extbase domain models

Added by Torben Hansen about 1 month ago. Updated 10 days ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2024-04-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When an extbase domain Model has a property, which implements DomainObjectInterface and is nullable, it is impossible to set the property of an existing object to null, because the database field is defined does not accept NULL as value. When saved through DataHandler, a nullable (e.g. tca=group) field saves 0 as value for those fields.

Example:

protected ?Person $author = null;

If the object with the $author property is persisted with a valid relation to a Person model, Extbase persists the UID of the person. Setting the field to null e.g. in controller (e.g. $blog->setAuthor(null)), results in the following exception Column 'author cannot be null, since Extbase persistence tries to save a NULL value to the not nullable database field.

Extbase should consider this scenario and save 0 for nullable properties which implement DomainObjectInterface

The same applies to nullable DateTime fields, which show the same behavior. (see #88515)


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #88515: Cannot unset DateTime value via nullAccepted2019-06-07

Actions
Actions

Also available in: Atom PDF