/** * @param Ess_M2ePro_Model_Processing_Request $processingRequest * @throws Ess_M2ePro_Model_Exception_Logic */ public function setProcessingLocks(Ess_M2ePro_Model_Processing_Request $processingRequest) { parent::setProcessingLocks($processingRequest); $this->account->addObjectLock(NULL, $processingRequest->getHash()); $this->account->addObjectLock('server_synchronize', $processingRequest->getHash()); $this->account->addObjectLock('deleting_from_server', $processingRequest->getHash()); }
public function setProcessingLocks(Ess_M2ePro_Model_Processing_Request $processingRequest) { parent::setProcessingLocks($processingRequest); $identifier = $this->getLockIdentifier(); $alreadyLockedListings = array(); $alreadyLockedParents = array(); foreach ($this->listingsProducts as $listingProduct) { /** @var $listingProduct Ess_M2ePro_Model_Listing_Product */ $listingProduct->addObjectLock(NULL, $processingRequest->getHash()); $listingProduct->addObjectLock('in_action', $processingRequest->getHash()); $listingProduct->addObjectLock($identifier . '_action', $processingRequest->getHash()); /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager $variationManager */ $variationManager = $listingProduct->getChildObject()->getVariationManager(); if ($variationManager->isRelationChildType()) { $parentListingProduct = $variationManager->getTypeModel()->getParentListingProduct(); if (isset($alreadyLockedParents[$parentListingProduct->getId()])) { continue; } $parentListingProduct->addObjectLock(NULL, $processingRequest->getHash()); $parentListingProduct->addObjectLock('child_products_in_action', $processingRequest->getHash()); $alreadyLockedParents[$parentListingProduct->getId()] = true; } if (isset($alreadyLockedListings[$listingProduct->getListingId()])) { continue; } $listingProduct->getListing()->addObjectLock(NULL, $processingRequest->getHash()); $alreadyLockedListings[$listingProduct->getListingId()] = true; } }
/** * @param Ess_M2ePro_Model_Processing_Request $processingRequest * @throws Ess_M2ePro_Model_Exception_Logic */ public function setProcessingLocks(Ess_M2ePro_Model_Processing_Request $processingRequest) { parent::setProcessingLocks($processingRequest); if (!isset($this->params['items']) || !is_array($this->params['items'])) { return; } $ordersIds = array(); foreach ($this->params['items'] as $item) { if (!isset($item['order_id'])) { throw new Ess_M2ePro_Model_Exception_Logic('Order ID is not defined.'); } $ordersIds[] = (int) $item['order_id']; } /** @var Ess_M2ePro_Model_Order[] $orders */ $orders = Mage::getModel('M2ePro/Order')->getCollection()->addFieldToFilter('component_mode', Ess_M2ePro_Helper_Component_Amazon::NICK)->addFieldToFilter('id', array('in' => $ordersIds))->getItems(); foreach ($orders as $order) { $order->addObjectLock('cancel_order', $processingRequest->getHash()); } }