/** * @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; }
/** * @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()); }
/** * @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); }
/** * 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); }