/** * Processing object after save data * * @return $this */ public function afterSave() { $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) { $this->_getResource()->addCommitCallback([$this, 'reindex']); } return parent::afterSave(); }
/** * Save child collections * * @return $this */ public function afterSave() { parent::afterSave(); if (null !== $this->_items) { $this->getItemsCollection()->save(); } if (null !== $this->_rates) { $this->getShippingRatesCollection()->save(); } return $this; }