OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Integration and "invalid entities"

This topic contains 3 replies, has 3 voices, and was last updated by  Rachid 7 years, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #34022

    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
  • #34023

    Rodolfo
    Participant

    Question 2 solved with:

    #34024

    Sergey
    Participant

    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

    #34025

    Rachid
    Participant

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

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

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top