Issues with ORM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jorge@netcare.mx
    Member
    • Apr 2020
    • 34

    Issues with ORM

    Hi,

    I'm New at ORM dev, but bassically, I have this:

    I read a xml file in order to insert all records in a table (created manually through mysql in the same ESPO database, is this possible?

    Then, I run a php script using CRON server service, no with the ESPO, to update this table.

    Finally, I move all records from this table to another created from Espo entity manager, but when I browse the entity at Espo CRM, I receive a 500 database error; I see the error is because it says the created ID, modified ID, assigned ID, are not being saved correctly, except the for the last record.

    That's why I'm thinking I'm not doing properly steps.

    So I began to read about ORM, I think this will simplify everything, the problem is, I don't know how to execute this file.

    Can anybody guide me in the how to?
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    If you can convert your xml file to csv you could just create a table using the entity manager and then import all records. http://​​​​​​​https://docs.espocrm.com/administration/import/

    ORM is basically a layer ("metalanguage") that Espo uses to centralize and control interactions with the database so you can execute queries using ORM or just using plain vanilla SQL (not officially recommended). https://docs.espocrm.com/development/orm/

    Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #3
      Hello,
      i do +- exactly same .. :

      1) i use document in espocrm
      2) added a custom field for say : itsXML (enum is better) ( yes/done)
      3) create new record document, put xml file, say : itsXML to yes
      4) create a cron job (every 10min) : who list all document itsXML to yes
      5) job transform XML to CSV or .. you read XML and inject in database with ORM

      6) job put the itsXML field to 'done'
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment

      • jorge@netcare.mx
        Member
        • Apr 2020
        • 34

        #4
        Great! thank you! will try.

        Comment

        Working...