Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 3 replies, has 3 voices, and was last updated by  Abdessamad 1 year, 5 months ago.

  • Creator
    Topic
  • #15153

    Rodolfo
    Participant

    Hi,

    I’m creating an integration for LivechatInc that has a custom connector. And this is one example if I want to insert data that already exists in my database. (The way I found to avoid duplicated data is using the annotation: @UniqueEntity("chatId")

    Stats: read [36], processed [0], updated [0], added [0], deleted [0], invalid entities: [36]

    For some reason even having “invalid entities”, the message above is being saved on my oro_integration_channel_status with “code” = 1.

    1) Isn’t it suppose to save code = 2 that means failed ?

    I’m using read() method in my connector to add an extra data with the lastSyncDate following this (which by the way only works if I add return $item. I submitted a PR fixing the doc)

    2) Is it possible to know from my read() method if I got “invalid entities” ?

    Thank you,
    Rodolfo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #15154

    Rodolfo
    Participant

    Question 2 solved with:

    #15189

    Sergey
    Oro Core

    Hi, Rodolfo!

    @UniqueEntity("chatId") might be very heavy for import process, because each entity will cause

    select * from table limit 1 query to check value is unique.

    Good practice is to set chatId and integration (or channel, depends on your entity) to identities using annotation

    So import strategy will check entity exists in database, update existing if found or create new one if not.

    You can use MailChimpBundle:Member as an example https://github.com/orocrm/OroCRMMailChimpBundle/blob/master/Entity/Member.php#L79

    #18427

    Abdessamad
    Participant

    Is there any tutorial on how to work with Integration bundle
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

ssossossosso