MetaModels / attribute_alias

The alias attribute
GNU Lesser General Public License v3.0
0 stars 6 forks source link

MySQL strict mode compatibility #28

Closed zonky2 closed 4 years ago

zonky2 commented 4 years ago

with MySQL strict mode we have the follow error

An exception occurred while executing 'UPDATE mm_employees SET alias = ? WHERE id = ?' with params [null, 80]:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'alias' cannot be null

we can include serializeData with

    public function serializeData($value)
    {
        return $value === null ? '' : $value;
    }

or we change getSQLDataType and set default to NULL

btw: if we change the default from '' to NULL, we must write a updating script - or not?

richardhj commented 4 years ago

Allowing null should be fine.

zonky2 commented 4 years ago

Allowing

hmm? is not the question whether we set NULL or '' as default? and not whether we allow what or not...

zonky2 commented 4 years ago

discussed with @discordier: we set default to NULL - also for other text based attributes; we have to create an updater yet

Ainschy commented 4 years ago

there is a issue when you use force_alias

UPDATE mm_metamodel SET alias = ? WHERE id = ?' with params [null, 5]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'alias' cannot be null

discordier commented 4 years ago

@Ainschy This is already fixed in #29, we need the migration though to finish it. This is on hold until we have https://github.com/contao-community-alliance/contao-polyfill-bundle/pull/2 out of the door.

zonky2 commented 4 years ago

fixed