Exemplo n.º 1
0
 /**
  * @param Customer $entity
  *
  * @return Customer
  */
 protected function checkExistingCustomer(Customer $entity)
 {
     if (!$entity->getEmail()) {
         return null;
     }
     $existingCustomer = $this->databaseHelper->findOneBy('OroCRM\\Bundle\\MagentoBundle\\Entity\\Customer', ['email' => $entity->getEmail(), 'channel' => $entity->getChannel()]);
     return $existingCustomer;
 }
 /**
  * @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;
 }