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());
More Related Contents:
- Use a DATE() function in a WHERE clause with DQL
- Doctrine2: Best way to handle many-to-many with extra columns in reference table
- Is there a built-in way to get all of the changed/updated fields in a Doctrine 2 entity
- How to encode Doctrine entities to JSON in Symfony 2.0 AJAX application?
- How to re-save the entity as another row in Doctrine 2
- Can I access discriminator field from php in doctrine2?
- How to force Doctrine to update array type fields?
- Limiting a doctrine query with a fetch-joined collection?
- How can I use DATE() in Doctrine 2 DQL?
- Why I am suddenly getting a “Typed property must not be accessed before initialization” error when introducing properties type hints?
- Why doesn’t MySQL support millisecond / microsecond precision?
- Default value in Doctrine
- Doctrine Query Language get Max/Latest Row Per Group
- Should I use EAV model?
- Select entries between dates in doctrine 2
- What is a Proxy in Doctrine 2?
- Generating a single Entity from existing database using symfony2 and doctrine
- Doctrine – How to print out the real sql, not just the prepared statement?
- How to get a one-dimensional scalar array as a doctrine dql query result?
- Execute raw SQL using Doctrine 2
- Auto quote reserved words with Doctrine 2
- How to use a findBy method with comparative criteria
- php/symfony/doctrine memory leak?
- “Class XXX is not a valid entity or mapped super class” after moving the class in the filesystem
- PHP ORMs: Doctrine vs. Propel
- Using Raw SQL with Doctrine
- How to configure naming strategy in Doctrine 2
- CASTING attributes for Ordering on a Doctrine2 DQL Query
- Get entityManager inside an Entity
- Primary key of owning side as a join column