LiipTestFixturesBundle
LiipTestFixturesBundle copied to clipboard
feat: allow doctrine/orm 3, doctrine/dbal 4 (WIP)
jackalope/jackalope-doctrine-dbal does not yet support dbal 4 (but they are working on it)
Now an installable set is available.
There are multiple errors. One is this, that change was intoduced in doctrine/orm 2.16.x (later removed) and reintoduced in 3.x. If someone knows how to fix it, please let me know.
Doctrine\ORM\Exception\EntityIdentityCollisionException: While adding an entity of class Liip\Acme\Tests\App\Entity\User with an ID hash of "1" to the identity map,
│ another object of class Liip\Acme\Tests\App\Entity\User was already present for the same ID. This exception
│ is a safeguard against an internal inconsistency - IDs should uniquely map to
│ entity object instances. This problem may occur if:
│
│ - you use application-provided IDs and reuse ID values;
│ - database-provided IDs are reassigned after truncating the database without
│ clearing the EntityManager;
│ - you might have been using EntityManager#getReference() to create a reference
│ for a nonexistent ID that was subsequently (by the RDBMS) assigned to another
│ entity.
│
│ Otherwise, it might be an ORM-internal inconsistency, please report it.
One is this, that change was intoduced in doctrine/orm 2.16.x (later removed) and reintoduced in 3.x. If someone knows how to fix it, please let me know.
Just looking at the test fixtures, I don't have a good solution here. But, all the setId()
calls are probably what is causing the ORM's identity map exception. If the tests can be updated in a way that they don't rely on specific primary key values then that would be the best course of action.
@mbabker Thanks for the input.
My primary goal is to test my bundle via this bundle ;)
I will come back to this as soon, as i have some free time.
I did split the PRs https://github.com/liip/LiipTestFixturesBundle/pull/269 and https://github.com/liip/LiipTestFixturesBundle/pull/268
After that is merged, maybe just simpify things and https://github.com/liip/LiipTestFixturesBundle/issues/272 and add support for doctrine/orm 3, doctrine/dbal 4 after that?
You can rebase it on 2.x
.
Or apply these changes from the 3.x
branch and target this branch when creating another PR, see:
- #272
I think it has been partially fixed by this PR:
- #296
doctrine/dbal
4 is not supported yet.
thanks @alexislefebvre I did rebase against 2.x. There are no useful changes in this PR anymore. I will close this PR.