The following code is in a migration. It runs fine and there are no errors and prints SAVED
, but nothing is saved in the globalsets
database table.
All my other content migrations run fine so it is not a DB issue.
$globalConfig = [
"type" => \craft\elements\GlobalSet::class,
"settings" => [
"name" => "Meta",
"handle" => "meta"
],
];
$element = Craft::$app->getElements()->createElement($globalConfig);
if (Craft::$app->getElements()->saveElement($element)) {
print "SAVED";
}
Why is this not saving ?
saveElement()
, does$element->getErrors()
return anything? – Brad Bell Sep 25 '19 at 19:41