OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Insert Data into DB with persist

This topic contains 6 replies, has 3 voices, and was last updated by  Yevhen Shyshkin 9 years, 11 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
  • #24747

    Hi, I’ve a littre problem. I want add to my DB an object Invoice.

    And my Entity Invoice, I use account_id (reference to Oro Account Bundle) :

    My problem is when I want add to my DB, I’ve an error.
    I can’t add my new object.

    If you are an idea, thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #24748

    Important:

    I have a Bundle Invoice and a Bundle Local where I make all my works. I want send into my DB my new Object Invoice (in the Local Bundle).

    #24749

    Dima Soroka
    Keymaster

    Can you please post the error message and Invoice entity definition?

    #24750

    Hi, my Invoice entity :

    The error message is:

    That’s all.

    #24751

    Yevhen Shyshkin
    Participant

    Hello, ruizalexandre.

    1) First you have to set Doctrine ORM annotations for entity and fields – @ORM/Table and @ORM/Entity for class, and @ORM\Id, @ORM\Column etc. for fields (see https://github.com/orocrm/crm/blob/master/src/OroCRM/Bundle/SalesBundle/Entity/Lead.php).

    2) Then you can try to update your DB. To test that execute command `php app/console doctrine:schema:update –dump-sql` – it should show you SQL that creates DB table, and if it’s ok – `php app/console doctrine:schema:update –force` to execute SQL. You have to remember that this is ok only for debug – in any case you’ll need to add migration to create this entity.

    3) Ensure that your DB really contains table for your entity. You can either use UI DB manager, or do it from CLI.

    Try to do that – if you’ll still have an error – please, put it here.

    In general to generate DB entities I’d recommend to use command `php app/console generate:doctrine:entity` – it will add all required fields and annotations automatically.

    #24752

    Hi, I’ve made updates into my code. But I’ve the same error message.

    An idea?

    #24753

    Yevhen Shyshkin
    Participant

    Could you, please, do the same in dev mode and put here full error text with backtrace?
    Also you can found your errors in /app/logs/dev.log or /app/logs/prod.log.

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

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

Back to top