MetaModels / core

MetaModels Core Module
GNU Lesser General Public License v3.0
96 stars 42 forks source link

Error at save with API - pid doesn´t have default value - in strict mode #1371

Closed zonky2 closed 4 years ago

zonky2 commented 4 years ago

Error at save with API - pid doesn´t have default value - in strict mode e.g. MariaDB

use MetaModels\Item;

$modelName = 'mm_employees';
$factory   = $this->getContainer()->get('metamodels.factory');
$model     = $factory->getMetaModel($modelName);
$objItemMa = new Item($model, []);
$objItemMa->set('name', 'Mayer');
$objItemMa->save();

echo 'Generate item id: ' . $objItemMa->get('id');
discordier commented 4 years ago

The problem is, that the values are never added in new Item(), nor saved in MetaModel::createNewItem() or MetaModel::saveItem(). In fact, the latter one postpones the saving of some system columns to MetaModels::saveBaseColumns() which does not work in strict mode anymore.

zonky2 commented 4 years ago

not repeatable...