Exemple #1
0
 public function delete()
 {
     $temp = parent::delete();
     $temp && ($this->listingProductVariationModel = NULL);
     $temp && ($this->magentoProductModel = NULL);
     return $temp;
 }
Exemple #2
0
 public function delete()
 {
     $temp = parent::delete();
     $temp && ($this->accountModel = NULL);
     $temp && ($this->marketplaceModel = NULL);
     $temp && ($this->magentoProductModel = NULL);
     return $temp;
 }
Exemple #3
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $this->order = NULL;
     $this->deleteChildInstance();
     return parent::delete();
 }
 /**
  * @return \Ess\M2ePro\Model\ActiveRecord\Component\Parent\AbstractModel
  * @throws \Ess\M2ePro\Model\Exception\Logic
  */
 public function getParentObject()
 {
     if (is_null($this->getId())) {
         throw new \Ess\M2ePro\Model\Exception\Logic('Method require loaded instance first');
     }
     if (!is_null($this->parentObject)) {
         return $this->parentObject;
     }
     $tempMode = $this->getComponentMode();
     if (is_null($tempMode)) {
         throw new \Ess\M2ePro\Model\Exception\Logic('Set Component Mode first');
     }
     $modelName = str_replace('Ess\\M2ePro\\Model\\ResourceModel\\' . ucwords($tempMode) . '\\', '', $this->_resourceName);
     if ($this->isCacheLoading()) {
         $this->parentObject = $this->activeRecordFactory->getCachedObjectLoaded($modelName, $this->getId());
     } else {
         $this->parentObject = $this->activeRecordFactory->getObjectLoaded($modelName, $this->getId());
     }
     $this->parentObject->setChildMode($tempMode);
     $this->parentObject->setChildObject($this);
     return $this->parentObject;
 }
Exemple #5
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $options = $this->getOptions(true);
     foreach ($options as $option) {
         $option->delete();
     }
     $this->listingProductModel = NULL;
     $this->deleteChildInstance();
     return parent::delete();
 }
Exemple #6
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $variations = $this->getVariations(true);
     foreach ($variations as $variation) {
         $variation->delete();
     }
     $tempLog = $this->activeRecordFactory->getObject('Listing\\Log');
     $tempLog->setComponentMode($this->getComponentMode());
     $tempLog->addProductMessage($this->getListingId(), $this->getProductId(), $this->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_UNKNOWN, NULL, \Ess\M2ePro\Model\Listing\Log::ACTION_DELETE_PRODUCT_FROM_LISTING, 'Item was successfully Deleted', \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_MEDIUM);
     $this->listingModel = NULL;
     $this->magentoProductModel = NULL;
     $this->deleteChildInstance();
     return parent::delete();
 }
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $otherListings = $this->getOtherListings(true);
     foreach ($otherListings as $otherListing) {
         $otherListing->delete();
     }
     $orders = $this->getOrders(true);
     foreach ($orders as $order) {
         $order->delete();
     }
     $this->deleteChildInstance();
     $this->getHelper('Data\\Cache\\Permanent')->removeTagValues('marketplace');
     return parent::delete();
 }
Exemple #8
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $otherListings = $this->getOtherListings(true);
     foreach ($otherListings as $otherListing) {
         $otherListing->delete();
     }
     if ($this->isComponentModeEbay() && $this->getChildObject()->isModeSandbox()) {
         $listings = $this->getRelatedComponentItems('Listing', 'account_id', true);
         foreach ($listings as $listing) {
             $listing->delete();
         }
     }
     $orders = $this->getOrders(true);
     foreach ($orders as $order) {
         $order->delete();
     }
     $this->deleteChildInstance();
     $this->getHelper('Data\\Cache\\Permanent')->removeTagValues('account');
     return parent::delete();
 }
 public function getCacheGroupTags()
 {
     return array_merge(parent::getCacheGroupTags(), ['template']);
 }
Exemple #10
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $items = $this->getRelatedSimpleItems('Listing\\Auto\\Category', 'group_id', true);
     foreach ($items as $item) {
         $item->delete();
     }
     $this->deleteChildInstance();
     return parent::delete();
 }
 protected function prepareChildObject(\Ess\M2ePro\Model\ActiveRecord\Component\Parent\AbstractModel $object)
 {
     $data = $object->getData();
     $object->unsetData();
     $modelName = str_replace('Ess\\M2ePro\\Model', ucwords($this->childMode), $this->_model);
     $childObject = $this->activeRecordFactory->getObject($modelName);
     $childColumnsData = $this->getConnection()->describeTable($this->getResource()->getChildTable());
     foreach ($childColumnsData as $columnData) {
         if (!isset($data[$columnData['COLUMN_NAME']])) {
             continue;
         }
         $childObject->setData($columnData['COLUMN_NAME'], $data[$columnData['COLUMN_NAME']]);
         unset($data[$columnData['COLUMN_NAME']]);
     }
     // setting parent data + data from additionally joined tables
     $object->setData($data);
     $object->setOrigData();
     $childObject->setParentObject($object);
     $childObject->setOrigData();
     $object->setChildObject($childObject);
     return $object;
 }
Exemple #12
0
 public function delete()
 {
     if ($this->isLocked()) {
         return false;
     }
     $products = $this->getProducts(true);
     foreach ($products as $product) {
         $product->delete();
     }
     $categoriesGroups = $this->getAutoCategoriesGroups(true);
     foreach ($categoriesGroups as $categoryGroup) {
         $categoryGroup->delete();
     }
     $tempLog = $this->activeRecordFactory->getObject('Listing\\Log');
     $tempLog->setComponentMode($this->getComponentMode());
     $tempLog->addListingMessage($this->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_UNKNOWN, NULL, \Ess\M2ePro\Model\Listing\Log::ACTION_DELETE_LISTING, 'Listing was successfully deleted', \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_HIGH);
     $this->accountModel = NULL;
     $this->marketplaceModel = NULL;
     $this->deleteChildInstance();
     $this->getHelper('Data\\Cache\\Permanent')->removeTagValues('listing');
     return parent::delete();
 }