Skip to content

Commit

Permalink
Addition to 6ceea26
Browse files Browse the repository at this point in the history
  • Loading branch information
brusch committed Oct 19, 2018
1 parent d93f4b0 commit 593880d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion models/DataObject/AbstractObject.php
Expand Up @@ -590,12 +590,13 @@ public function save()

$isUpdate = false;

$isDirtyDetectionDisabled = self::isDirtyDetectionDisabled();
$preEvent = new DataObjectEvent($this, $params);
if ($this->getId()) {
$isUpdate = true;
\Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::PRE_UPDATE, $preEvent);
} else {
AbstractObject::disableDirtyDetection();
self::disableDirtyDetection();
\Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::PRE_ADD, $preEvent);
}

Expand Down Expand Up @@ -700,6 +701,7 @@ public function save()
if ($isUpdate) {
\Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::POST_UPDATE, new DataObjectEvent($this));
} else {
self::setDisableDirtyDetection($isDirtyDetectionDisabled);
\Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::POST_ADD, new DataObjectEvent($this));
}

Expand Down

0 comments on commit 593880d

Please sign in to comment.