/**
  * @param Customer $value
  * @return array
  */
 protected function getRemoteCustomers($value)
 {
     $this->transport->init($value->getChannel()->getTransport());
     $filter = new BatchFilterBag();
     $filter->addComplexFilter('email', ['key' => 'email', 'value' => ['key' => 'eq', 'value' => $value->getEmail()]]);
     $filter->addComplexFilter('store_id', ['key' => 'store_id', 'value' => ['key' => 'eq', 'value' => $value->getStore()->getOriginId()]]);
     $filters = $filter->getAppliedFilters();
     $customers = $this->transport->call(SoapTransport::ACTION_CUSTOMER_LIST, $filters);
     return (array) $customers;
 }
Example #2
0
 /**
  * @param array $ids
  */
 protected function loadEntities(array $ids)
 {
     if (!$ids) {
         return;
     }
     $filters = new BatchFilterBag();
     $filters->addComplexFilter('in', ['key' => $this->getIdFieldName(), 'value' => ['key' => 'in', 'value' => implode(',', $ids)]]);
     if (null !== $this->websiteId && $this->websiteId !== StoresSoapIterator::ALL_WEBSITES) {
         $filters->addWebsiteFilter([$this->websiteId]);
     }
     $this->loadByFilters($filters->getAppliedFilters());
 }
Example #3
0
 /**
  * @param array $ids
  */
 protected function loadEntities(array $ids)
 {
     if (!$ids) {
         return;
     }
     $filters = new BatchFilterBag();
     $filters->addComplexFilter('in', ['key' => $this->getIdFieldName(), 'value' => ['key' => 'in', 'value' => implode(',', $ids)]]);
     if (null !== $this->websiteId && $this->websiteId !== StoresSoapIterator::ALL_WEBSITES) {
         $filters->addStoreFilter($this->getStoresByWebsiteId($this->websiteId));
     }
     $filters = $filters->getAppliedFilters();
     $filters['pager'] = ['page' => $this->getCurrentPage(), 'pageSize' => $this->pageSize];
     $this->loadByFilters($filters);
 }
Example #4
0
 /**
  * Process search for removal carts in CRM and mark them as "expired"
  *
  * @param array $ids
  */
 protected function processBatch($ids)
 {
     $filterBag = new BatchFilterBag();
     $filterBag->addStoreFilter($this->stores);
     $filterBag->addComplexFilter('entity_id', ['key' => 'entity_id', 'value' => ['key' => 'in', 'value' => implode(',', array_keys($ids))]]);
     $filters = $filterBag->getAppliedFilters();
     $filters['pager'] = ['page' => 1, 'pageSize' => $this->batchSize];
     $result = $this->transport->call(SoapTransport::ACTION_ORO_CART_LIST, $filters);
     $result = WSIUtils::processCollectionResponse($result);
     $resultIds = array_map(function (&$item) {
         return (int) $item->entity_id;
     }, $result);
     $resultIds = array_flip($resultIds);
     $removedIds = array_values(array_diff_key($ids, $resultIds));
     $this->em->getRepository('OroCRMMagentoBundle:Cart')->markExpired($removedIds);
 }