ssossossossosso

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 3 years, 8 months ago.

  • Creator
    Topic
  • #22127

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

    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).

    #22129

    Dima Soroka
    Keymaster

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

    #22130

    Hi, my Invoice entity :

    The error message is:

    That’s all.

    #22131

    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.

    #22132

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

    An idea?

    #22133

    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)

You must be logged in to reply to this topic.