SQL-Errors on new records and translations
We use EXT:sg_cookie_optin in different TYPO3 projects with different server environments. After TYPO3 Upgrades and extension updates, we get the following situation:
Version 3.2.8
SQL error: 'Incorrect integer value: '' for column typo3_database.tx_sgcookieoptin_domain_model_cookie.parent_optin at row 1' (tx_sgcookieoptin_domain_model_cookie:NEW601a8a442d7ab984951541)
SQL error: 'Incorrect integer value: '' for column typo3_database.tx_sgcookieoptin_domain_model_script.parent_optin at row 1' (tx_sgcookieoptin_domain_model_cookie:NEW601a8a442d7ab984951541)
The same is for field "parent_group".
We tested it with:
- TYPO3 9.5.23/.24
- php 7.2
- MariaDB 10.2/.3
- With Strict-Mode and without any SQL-Mode of MariaDB
Solution
Set default value via TCA of field parent_group and parent_optin in table tx_sgcookieoptin_domain_model_cookie and tx_sgcookieoptin_domain_model_script.
$GLOBALS[TCA][tx_sgcookieoptin_domain_model_cookie]['columns'][parent_optin][config][default] = 0
$GLOBALS[TCA][tx_sgcookieoptin_domain_model_cookie]['columns'][parent_group][config][default] = 0
$GLOBALS[TCA][tx_sgcookieoptin_domain_model_script]['columns'][parent_optin][config][default] = 0
$GLOBALS[TCA][tx_sgcookieoptin_domain_model_script]['columns'][parent_group][config][default] = 0
Please set this config to prevent this error. Their are many changes since TYPO3 9.5.16 in combination with MariaDB. MariaDB needs values. We set in our extensions every time a default value if necessary and set in ext_tables.sql as well.
@see: #145 (closed)