doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.78k stars 224 forks source link

Fix issue referencing a non string object ID #287

Closed xaben closed 2 years ago

xaben commented 6 years ago

When using Value Object as IDs in Doctrine, the ProxyReferenceRepository fails to unserialize the reference repository. This is caused by the fact that json_encode and json_decode does not know how to persist information about these objects (as it expects to have a plain data structure with string for IDs).

This PR solves it by using serialize and unserialize instead.

Ocramius commented 6 years ago

Requires test additions

xaben commented 6 years ago

@Ocramius Are the tests like this ok?

I tried adding a separate entity and a separate test but the insert into DB always failed, perhaps I missed some setup procedure somewhere.