Director rollback in case of existing object during live-creation
This commit is contained in:
parent
b1c29c16d0
commit
407ccddc2f
|
@ -124,7 +124,8 @@ class ObjectCommand extends Command
|
||||||
if ($this->api()->createObjectAtRuntime($object)) {
|
if ($this->api()->createObjectAtRuntime($object)) {
|
||||||
echo "Live creation for '$name' succeeded\n";
|
echo "Live creation for '$name' succeeded\n";
|
||||||
} else {
|
} else {
|
||||||
echo "Live creation for '$name' succeeded\n";
|
echo "Live creation for '$name' failed\n";
|
||||||
|
$object->delete();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,10 +314,11 @@ class CoreApi implements DeploymentApiInterface
|
||||||
$key = $object->getShortTableName();
|
$key = $object->getShortTableName();
|
||||||
|
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
"f = function() {\n"
|
'existing = get_%s("%s")'
|
||||||
. ' existing = get_%s("%s")'
|
. "\nf = function() {\n"
|
||||||
. "\n if (existing) { return false }"
|
. "%s\n}\n"
|
||||||
. "\n%s\n}\nInternal.run_with_activation_context(f)\n",
|
. "if (existing) { false } else {\n"
|
||||||
|
. "Internal.run_with_activation_context(f)\n}\n",
|
||||||
$key,
|
$key,
|
||||||
$object->get('object_name'),
|
$object->get('object_name'),
|
||||||
(string) $object
|
(string) $object
|
||||||
|
|
Loading…
Reference in New Issue