Announcement

Collapse
No announcement yet.

insert data in new database table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • insert data in new database table

    Hi,

    i have many entities from a json file. Now I want to write these objects in the database. I use a custom cron and write my code in run() - it is working.
    choice i have:
    • $this->getConfig();
    • $this->getContainer();
    • $this->getEntityManager();
    • $this->getMetadata();
    • $this->getServiceFactory();
    • $this->getUser();
    what is the best way? which functions should i use? or you can give me a small code example?

    thanks
    Last edited by tritian; 09-18-2015, 09:19 PM.

  • #2
    $account = $this->getEntityManager()->getEntity('Account');
    $account->set(array(
    'name' => 'Test'
    'assignedUserId' => '1'
    ));
    $this->getEntityManager()->save($entity);

    EspoCRM Documentation. Contribute to espocrm/documentation development by creating an account on GitHub.

    Comment


    • #3
      Oh, sorry. i don't see it... thank you.

      Comment

      Working...
      X