Important: #106656 - Allow DEFAULT NULL for varchar fields
See forge#106656
Description
In TCA, if an input field is configured to be nullable via
'nullable' => true, the database migration now respects this and creates
or updates existing fields with DEFAULT NULL.
In Extbase, this may cause issues if properties and their accessor methods are not properly declared as nullable. Therefore, this change is introduced only in TYPO3 v14.
Example:
Example properly implementing a nullable property
<?php
declare(strict_types=1);
namespace Vendor\MyExtension\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class MyExtbaseEntity extends AbstractEntity
{
protected ?string $title;
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): void
{
$this->title = $title;
}
}
Copied!
As stated above, this automatic detection is not provided in TYPO3 versions
earlier than 14.0. Using DEFAULT NULL can be enforced via an extension's
ext_ instead:
CREATE TABLE tx_myextension_table (
title varchar(255) DEFAULT NULL
);
Copied!