/** * @param StockInterface $stock * @return bool|true * @throws CouldNotDeleteException */ public function delete(StockInterface $stock) { try { $this->resource->delete($stock); } catch (\Exception $exception) { throw new CouldNotDeleteException(__($exception->getMessage())); } return true; }
/** * @param StockInterface $stock * @return bool|true * @throws CouldNotDeleteException */ public function delete(StockInterface $stock) { try { $this->resource->delete($stock); $this->getStockRegistryStorage()->removeStock(); } catch (\Exception $exception) { throw new CouldNotDeleteException(__('Unable to remove Stock with id "%1"', $stock->getStockId()), $exception); } return true; }