🎨 \DBObject::DBDeleteSingleObject : isolate exit condition at the top

This commit is contained in:
Pierre Goiffon
2019-08-06 14:45:05 +02:00
parent e69275c6c5
commit 7e540f16f9

View File

@@ -3254,14 +3254,18 @@ abstract class DBObject implements iDisplay
*/
protected function DBDeleteSingleObject()
{
if (!MetaModel::DBIsReadOnly())
if (MetaModel::DBIsReadOnly())
{
return;
}
$this->OnDelete();
// Activate any existing trigger
$sClass = get_class($this);
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)"), array(), $aParams);
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)"), array(),
$aParams);
while ($oTrigger = $oSet->Fetch())
{
/** @var \Trigger $oTrigger */
@@ -3316,7 +3320,6 @@ abstract class DBObject implements iDisplay
// objects, reported as bug N°926)
// Thought the key is not reset, using DBInsert or DBWrite will create an object having the same characteristics and a new ID. DBUpdate is protected
}
}
/**
* Delete an object