Beispiel #1
0
 /**
  * @param \Ess\M2ePro\Model\Listing\Product $listingProduct
  * @return bool
  * @throws \Ess\M2ePro\Model\Exception\Logic
  */
 public function isMeetReviseSynchReasonsRequirements(\Ess\M2ePro\Model\Listing\Product $listingProduct)
 {
     $reasons = $listingProduct->getSynchReasons();
     if (empty($reasons)) {
         return false;
     }
     if (!$this->isMeetReviseGeneralRequirements($listingProduct)) {
         return false;
     }
     /** @var \Ess\M2ePro\Model\Amazon\Listing\Product $amazonListingProduct */
     $amazonListingProduct = $listingProduct->getChildObject();
     $synchronizationTemplate = $amazonListingProduct->getSynchronizationTemplate();
     $amazonSynchronizationTemplate = $amazonListingProduct->getAmazonSynchronizationTemplate();
     foreach ($reasons as $reason) {
         $method = 'isRevise' . ucfirst($reason);
         if (method_exists($synchronizationTemplate, $method)) {
             if ($synchronizationTemplate->{$method}()) {
                 return true;
             }
             continue;
         }
         if (method_exists($amazonSynchronizationTemplate, $method)) {
             if ($amazonSynchronizationTemplate->{$method}()) {
                 return true;
             }
             continue;
         }
     }
     return false;
 }