Bug #103641
closedNot possible so set nullable relation values in extbase domain models
100%
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)