Explicitly set Id with Doctrine when using “AUTO” strategy

前端 未结 7 698
时光说笑
时光说笑 2020-12-02 05:36

My entity uses this annotation for it\'s ID:

/**
 * @orm:Id
 * @orm:Column(type=\"integer\")
 * @orm:GeneratedValue(s         


        
相关标签:
7条回答
  • 2020-12-02 06:16

    Although your solution work fine with MySQL, I failed to make it work with PostgreSQL as It's sequence based.

    I've to add this line to make it work perfectly :

    $metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());

    Best regards,

    0 讨论(0)
提交回复
热议问题