Skip to content

Commit

Permalink
Added event-observer on item collection data load for caching
Browse files Browse the repository at this point in the history
  • Loading branch information
atravkovs committed Dec 16, 2019
1 parent 281ee7f commit 54738a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Model/ResourceModel/Item/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,19 @@ public function toItemOptionArray()

return $result;
}

/**
* @return $this
*/
protected function _afterLoadData()
{
parent::_afterLoadData();

$collection = clone $this;
if (count($collection)) {
$this->_eventManager->dispatch('scandipwa_menuorganizer_item_collection_load_after', ['collection' => $collection]);
}

return $this;
}
}

0 comments on commit 54738a6

Please sign in to comment.