Example #1
0
 /**
  * Perform actions after object delete
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _afterDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     if ($this->gridAggregator) {
         $this->gridAggregator->purge($object->getId());
     }
     parent::_afterDelete($object);
     return $this;
 }
Example #2
0
 /**
  * Handles asynchronous insertion of the new entity into
  * corresponding grid during cron job.
  *
  * Also method is used in the next events:
  *
  * - config_data_dev_grid_async_indexing_disabled
  *
  * Works only if asynchronous grid indexing is enabled
  * in global settings.
  *
  * @return void
  */
 public function asyncInsert()
 {
     if ($this->globalConfig->getValue('dev/grid/async_indexing')) {
         $this->entityGrid->refreshBySchedule();
     }
 }
Example #3
0
 public function testAsyncInsertDisabled()
 {
     $this->scopeConfigurationMock->expects($this->once())->method('getValue')->with('dev/grid/async_indexing', 'default', null)->willReturn(false);
     $this->gridAggregatorMock->expects($this->never())->method('refreshBySchedule');
     $this->indexGrid->asyncInsert();
 }