Merge pull request #11896 from tuxgasy/10.0_childtablesoncascade_isempty

Check if childtablesoncascade is not empty
This commit is contained in:
Laurent Destailleur 2019-09-15 10:16:07 +02:00 committed by GitHub
commit f946ec0563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7536,6 +7536,7 @@ abstract class CommonObject
} }
// Delete cascade first // Delete cascade first
if (! empty($this->childtablesoncascade)) {
foreach($this->childtablesoncascade as $table) foreach($this->childtablesoncascade as $table)
{ {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
@ -7547,6 +7548,7 @@ abstract class CommonObject
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
}
} }
if (! $error) { if (! $error) {