View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007139 | OXID eShop (all versions) | 7. --- Other tools -------------- | public | 2020-05-19 08:29 | 2020-05-19 08:32 |
Reporter | michael_keiluweit | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 6.2.1 | ||||
Summary | 0007139: After executing an insert event an update event is always executed too. | ||||
Description | Registering 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 Reproduce | Follow the example: https://docs.oxid-esales.com/developer/en/6.2/development/tell_me_about/event/event_example.html | ||||
Additional Information | Saving 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. | ||||
Tags | Event | ||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||