/** * Mark product as exported in DB * * @param $exportId */ private function _setProductExported($exportId) { $export = $this->_exportFactory->create()->load($exportId); $export->setData('is_exported', '1'); try { $export->save(); } catch (\Exception $e) { $this->_logger->addCritical($e->getMessage()); } }
/** * Save the new export item with Product Id * * @param $productId * @return Export */ public function saveProductForExport($productId) { $exportItem = $this->_exportFactory->create(); $exportItem->setData('product_id', $productId); try { $exportItem->save(); } catch (\Exception $e) { $this->_logger->addError($e->getMessage()); } return $exportItem; }
/** * Load the item model by using product ID as identifier. * * //todo move this into a proper loadByProductId method on the model. * * @param $productId * @return $this */ private function _getItemModel($productId) { $item = $this->_exportFactory->create()->getCollection()->addFieldToFilter('product_id', $productId)->getFirstItem(); return $this->_exportFactory->create()->load($item->getId()); }