Epic #68397: Make TYPO3 work with MySQL strict mode
Inserting records fails when the model has a incompatible default value
Inserting a new record through an extbase repository fails if the model and the database schema have incompatible defaults.
If the model has a property `title` without any default value assigned (so its NULL for PHP) and the database schema has the column defined as `title varchar(255) DEFAULT '' NOT NULL` extbase tries to insert an explicit NULL into the database.
This is due to the new default value determination insertObject().
[FOLLOWUP][BUGFIX] Extbase: Use fully populated records in insertObject()
As it is common practice to define object properties in Extbase models
without default values (resulting in a NULL value) while defining the
database columns as `DEFAULT '' NOT NULL` these columns need to be
skipped when preparing a new record for insertion into the database.
This allows the database to use the configured defaults for columns
not included in the insert statement.
To properly support strict databases in an Extbase extension/model it is
required to configure identical/compatible default values in the
database schema and the model. This problem cannot be solved completely
Reviewed-by: Markus Klein <email@example.com>
Reviewed-by: Wouter Wolters <firstname.lastname@example.org>
Tested-by: Markus Klein <email@example.com>
Reviewed-by: Anja Leichsenring <firstname.lastname@example.org>
Tested-by: Anja Leichsenring <email@example.com>