Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pimcore6' into pimcore6
Browse files Browse the repository at this point in the history
  • Loading branch information
ctippler committed Dec 22, 2021
2 parents 78ddaff + 43803b5 commit 72e6c7a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/Model/CallbackSetting/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ public function save()

public function delete()
{
if ($this->model->getId()) {
$this->db->query('DELETE FROM '.$this->getTableName().' where id='.$this->model->getId());
$id = $this->model->getId();

if ($id) {
$this->db
->prepare('DELETE FROM ' . $this->getTableName() . ' WHERE `id` = ?')
->execute([$id]);

$this->model = null;
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/Model/Configuration/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,20 @@ protected function getTableName()

public function delete()
{
if ($this->model->getId()) {
$list = new MonitoringItem\Listing();
$list->setCondition('configurationId = ?', [$this->model->getId()]);
$items = $list->load();
$id = $this->model->getId();

if ($id) {
$items = (new MonitoringItem\Listing())
->setCondition('configurationId = ?', [$id])
->load();

foreach ($items as $item) {
$item->delete();
}
$this->db->query('DELETE FROM ' . $this->getTableName() . ' where id=' . $this->model->getId());

$this->db
->prepare('DELETE FROM ' . $this->getTableName() . ' WHERE `id` = ?')
->execute([$id]);
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/Model/MonitoringItem/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public function save($preventModificationDateUpdate = false)

public function delete()
{
if ($this->model->getId()) {
$id = $this->model->getId();

if ($id) {
foreach ((array)$this->model->getActions() as $action) {
if ($class = $action['class']) {
/**
Expand All @@ -96,10 +98,14 @@ public function delete()
}
}

$this->db->query('DELETE FROM '.$this->getTableName().' where id='.$this->model->getId());
$this->db
->prepare('DELETE FROM ' . $this->getTableName() . ' WHERE `id` = ?')
->execute([$id]);

if ($logFile = $this->model->getLogFile()) {
@unlink($logFile);
}

$this->model = null;
}
}
Expand Down

0 comments on commit 72e6c7a

Please sign in to comment.