You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ext_tables.sql has for example impressum text DEFAULT '' NOT NULL
MySQL can not have TEXT columns that are NOT NULL because NOT NULL implies having a DEFAULT, but TEXT can not have a default because it's a pointer-style column type (it's a sub-type of BLOB fields). So non-existing fields in the XML are stored as null, no matter what the column definition wishes to be. [NOT] NULL and DEFAULT are ignored in the SQL schema of BLOB fields.
The getter in the Extbase model is public function getImpressum(): string
which will then throw an error of must be of the type string, null returned
Also on direct mapping of the XML into the models these properties are null which lead to the same error.
There are two ways of solving this:
Return ?string, so make it nullable
Initialize the property to string: protected $impressum = '';, so force it to string -- this works at least for the mapping from Database, not sure if it works when mapping directly from the XML.
The text was updated successfully, but these errors were encountered:
SQL defintion of the TEXT fields should just be field_name TEXT in ext_tables.sql.
Also all not-null TCA fields should provide a default in their TCA config. Even when the official docs not list the default setting for a field type (it's respected by the DataHandler anyways). Inline relations are such a case, for example. The TCA should have 'default' => 0 for inline fields even though default is not listed as a config option. Anotehr case is passthrough.
All this is needed to make the extension fully compatible to SQL strict mode (which TYPO3 core aims to fully support in the future).
The
ext_tables.sql
has for exampleimpressum text DEFAULT '' NOT NULL
MySQL can not have
TEXT
columns that areNOT NULL
becauseNOT NULL
implies having aDEFAULT
, butTEXT
can not have a default because it's a pointer-style column type (it's a sub-type ofBLOB
fields). So non-existing fields in the XML are stored as null, no matter what the column definition wishes to be.[NOT] NULL
andDEFAULT
are ignored in the SQL schema ofBLOB
fields.The getter in the Extbase model is
public function getImpressum(): string
which will then throw an error of
must be of the type string, null returned
Also on direct mapping of the XML into the models these properties are
null
which lead to the same error.There are two ways of solving this:
?string
, so make it nullableprotected $impressum = '';
, so force it tostring
-- this works at least for the mapping from Database, not sure if it works when mapping directly from the XML.The text was updated successfully, but these errors were encountered: