bobosch / ods_osm

TYPO3 Extension OpenStreetMap
10 stars 22 forks source link

Add defaults in TCA because of DB "strict" mode #46

Closed sypets closed 4 years ago

sypets commented 4 years ago

Newer versions of Maria and MySQL DB use strict mode by default.

Because of this, you may get the following error when creating a system category with TYPO3 9:

2: SQL error: 'Incorrect integer value: '' for columntypo3v9.sys_category.tx_odsosm_markerat row 1' (sys_category:NEW5e7dcb49bf407625966352)

This can be resolved by adding a default in the TCA:

Configuration/TCA/Overrides/sys_category.php

$tempColumns = array(
    'tx_odsosm_marker' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:ods_osm/Resources/Private/Language/locallang_db.xml:tt_address_group.tx_odsosm_marker',
        'config' => array(
            'type' => 'group',
            'internal_type' => 'db',
            'allowed' => 'tx_odsosm_marker',
            'size' => 1,
            'minitems' => 0,
            'maxitems' => 1,

            // here >>>>
            'default' => 0,
             // <<<<<
        )
    ),
);

The same must be done for other tables and fields as well.

P.S. This is a common problem. I already had to patch this locally in other extensions.