/**
  * {@inheritdoc}
  */
 protected function findEntityByIdentityValues($entityName, array $identityValues)
 {
     if (is_a($entityName, 'OroCRM\\Bundle\\MagentoBundle\\Entity\\IntegrationAwareInterface', true)) {
         $identityValues['channel'] = $this->context->getOption('channel');
     }
     return parent::findEntityByIdentityValues($entityName, $identityValues);
 }
 /**
  * {@inheritdoc}
  */
 protected function beforeProcessEntity($entity)
 {
     if ($this->logger) {
         $this->logger->info('Syncing GitHub issue [origin_id=' . $entity->getRemoteId() . ']');
     }
     return parent::beforeProcessEntity($entity);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function process($entity)
 {
     $entity = parent::process($entity);
     if ($entity) {
         $this->updateAddresses($entity);
     }
     return $entity;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function findEntityByIdentityValues($entityName, array $identityValues)
 {
     // contact last name and first name must be in this order to support compound index
     if ($entityName == 'OroCRM\\Bundle\\ContactBundle\\Entity\\Contact') {
         if (array_key_exists('firstName', $identityValues) && array_key_exists('lastName', $identityValues)) {
             $firstName = $identityValues['firstName'];
             $lastName = $identityValues['lastName'];
             unset($identityValues['firstName']);
             unset($identityValues['lastName']);
             $identityValues = array_merge(array('lastName' => $lastName, 'firstName' => $firstName), $identityValues);
         }
     }
     return parent::findEntityByIdentityValues($entityName, $identityValues);
 }
 /**
  * @param ProductPrice $entity
  * @return ProductPrice|null
  *
  * {@inheritdoc}
  */
 protected function validateAndUpdateContext($entity)
 {
     $validatedEntity = parent::validateAndUpdateContext($entity);
     if (null !== $validatedEntity) {
         $processedEntities = (array) $this->context->getValue(self::PROCESSED_ENTITIES_HASH);
         $hash = $this->getEntityHashByUniqueFields($entity);
         if (!empty($processedEntities[$hash])) {
             $this->addEntityUniquenessViolation($entity);
             $validatedEntity = null;
         } else {
             $processedEntities[$hash] = true;
             $this->context->setValue(self::PROCESSED_ENTITIES_HASH, $processedEntities);
         }
     }
     return $validatedEntity;
 }
Exemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 protected function importExistingEntity($entity, $existingEntity, $itemData = null, array $excludedFields = array())
 {
     // manually handle recursive relation to contacts
     $entityName = ClassUtils::getClass($entity);
     $fieldName = 'contacts';
     if ($entity instanceof Account && $existingEntity instanceof Account && !$this->isFieldExcluded($entityName, $fieldName, $itemData) && !in_array($fieldName, $excludedFields)) {
         foreach ($existingEntity->getContacts() as $contact) {
             $existingEntity->removeContact($contact);
         }
         foreach ($entity->getContacts() as $contact) {
             $contact->removeAccount($entity);
             $existingEntity->addContact($contact);
         }
         $excludedFields[] = $fieldName;
     }
     parent::importExistingEntity($entity, $existingEntity, $itemData, $excludedFields);
 }
 /**
  * @param OriginAwareInterface $entity
  * @return OriginAwareInterface
  */
 protected function afterProcessEntity($entity)
 {
     $this->collectEntities($entity);
     return parent::afterProcessEntity($entity);
 }
 /**
  * {@inheritdoc}
  */
 protected function afterProcessEntity($entity)
 {
     $itemData = $this->context->getValue('itemData');
     $entity->setMergeVarValuesContext($itemData);
     return parent::afterProcessEntity($entity);
 }