This topic contains 2 replies, has 2 voices, and was last updated by Rodolfo 8 years, 3 months ago.
- Topic
Hi @sergey,
I implemented the annotation you suggested to me. Now I’m not getting error from doctrine if I try to insert a data with the same “chatId”.
So, I decided to verify if the data already exist from my ImportStrategy.php. I don’t want to update it. I just want to skip if the data already exist.
This is my process() method
/**
* {@inheritdoc}
*/
public function process($entity)
{
$entity = $this->beforeProcessEntity($entity);
$chatClass = 'Acme\Bundle\LivechatIntegrationBundle\Entity\Chat';
$existingEntity = (bool) parent::findEntityByIdentityValues($chatClass, [
'chatId' => $entity->getChatId()
]);
if (!$existingEntity) {
if ($this->logger) {
$this->logger->info('Syncing LiveChatInc chat_id=' .$entity->getChatId());
}
$entity = $this->processEntity($entity, true, true, $this->context->getValue('itemData'));
} else {
if ($this->logger) {
$this->logger->info('Ignoring existing ' .$entity->getChatId());
}
return null;
}
$entity = $this->afterProcessEntity($entity);
return $entity;
}
It’s working! It’s skipping existing items with the same ChatID. OK
The problem now is the final result. This is what I’m getting if I insert a new data never imported before:
Stats: read [51], processed [0], updated [0], added [0], deleted [0], invalid entities: [0]
CompletedQuestion 1) Why I’m not seeing added [51] ?
And this one is the result if I’m running the same import for the second time.
Stats: read [51], processed [0], updated [0], added [0], deleted [0], invalid entities: [0]
CompletedQuestion 2) So, how can I force the skipped items to show in “invalid entities: [51]” ?
Question 3) In both cases, on the table “oro_integration_channel_status” I have “code = 1” that means it didn’t failed. I need this code being set to 2 in order to make the next sync working.
Really appreciate any help, Thanks!
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.