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
new or updates existing fields with DEFAULT NULL
.
In Extbase, this may cause issues if properties and their accessor methods are not properly declared to be nullable, therefore this change is introduced to TYPO3 v14 only.
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
older 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!