View Issue Details

IDProjectCategoryView StatusLast Update
0007139OXID eShop (all versions)7. --- Other tools --------------public2020-05-19 08:32
Reportermichael_keiluweit Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version6.2.1 
Summary0007139: After executing an insert event an update event is always executed too.
DescriptionRegistering an insert and update event like in the given example: https://docs.oxid-esales.com/developer/en/6.2/development/tell_me_about/event/event_example.html
causes always to two entries when creating a new object. An insert log entry and an update log entry.
The reason for the two entries are a very own dispatchEvent call for the insert action, but afterwards the general "onChange" method is fired, which itself executes the dispatchEvent again.

\OxidEsales\EshopCommunity\Core\Model\BaseModel::save
// ...
if ($this->exists()) {
    // ...
} else {
    $response = $this->_insert();
    $action = ACTION_INSERT;
    $this->dispatchEvent(new AfterModelInsertEvent($this)); // <-- First time executing \OxidEsales\EshopCommunity\Core\Base::dispatchEvent
}

$this->onChange($action);  // <-- Second time executing \OxidEsales\EshopCommunity\Core\Base::dispatchEvent
Steps To ReproduceFollow the example: https://docs.oxid-esales.com/developer/en/6.2/development/tell_me_about/event/event_example.html
Additional InformationSaving a new category log:

expected:
[2020-05-19 08:31:10] OXID Logger.INFO: event: OxidEsales\EshopCommunity\Internal\Transition\ShopEvents\AfterModelInsertEvent with object object of type OxidEsales\Eshop\Application\Model\Category with id f11397b0de69d71f00445dd82c0c5aa0 [] []


actual:
[2020-05-19 08:31:10] OXID Logger.INFO: event: OxidEsales\EshopCommunity\Internal\Transition\ShopEvents\AfterModelInsertEvent with object object of type OxidEsales\Eshop\Application\Model\Category with id f11397b0de69d71f00445dd82c0c5aa0 [] []
[2020-05-19 08:31:11] OXID Logger.INFO: event: OxidEsales\EshopCommunity\Internal\Transition\ShopEvents\AfterModelUpdateEvent with object object of type OxidEsales\Eshop\Application\Model\Category with id f11397b0de69d71f00445dd82c0c5aa0 [] []






I noticed also, that an article update event causes also two log entries: a base model and a multilanguage model log entry, even when the article doesn't have a second language.
TagsEvent
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

There are no notes attached to this issue.