doctrine / data-fixtures

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

ORMPurger failing after update to v1.2 #227

Closed totaltrash closed 8 years ago

totaltrash commented 8 years ago

Since updating to v1.2.0, I get this when running purge: Doctrine\Common\DataFixtures\Exception\CircularReferenceException: Graph contains cyclic dependency.

Rolling back to v1.1.1, purge works fine.

mikeSimonson commented 8 years ago

The exception is telling you that there is an error in the declaration of your dependencies inside your fixtures.

mikeSimonson commented 8 years ago

maybe not so much #228

peterrehm commented 8 years ago

Should be fixed by #229 as well.

mikeSimonson commented 8 years ago

@totaltrash Can you confirm that #229 fixed your issue ?

totaltrash commented 8 years ago

Hmm, no #229 does not fix my issue. I'll try and get a test case together today.

totaltrash commented 8 years ago

More info @mikeSimonson - TopologicalSorter throws the exception on an abstract class that is providing a 'JOINED' inheritance type, and extended by two other classes. And, there is a relationship between those two classes. I've not confirmed that's the issue.

totaltrash commented 8 years ago

@mikeSimonson I've created an example 'application' to show where my issue is. I'll see if I can emulate how the dependencies get added by the purger so then should be able to create a test case. Anyway, check this out: https://github.com/totaltrash/example-data-fixtures. Can you please reopen this issue, or would you like me to open another?

Ocramius commented 8 years ago

@totaltrash can you try reproducing the issue within https://github.com/doctrine/data-fixtures/blob/b3cae5efef97191a08d53d733260f7eb667c16e4/tests/Doctrine/Tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php ? You can dump the state of the TopologicalSorter when the exception is thrown, too...

totaltrash commented 8 years ago

Lastly, I've dumped out how the dependencies get added to the topological sorter with that application above:

SubClassA has dependency SuperClass SubClassB has dependency SubClassA SuperClass has dependency SubClassA SubClassB has dependency SuperClass

The third line looks suspect - SuperClass (the abstract class) shouldn't be dependent on anything?

Ocramius commented 8 years ago

SuperClass should depend on SubClassA, but SubClassA shouldn't depend on SuperClass.

totaltrash commented 8 years ago

I don't know, is that what you would expect? SubClassA is the owning side of the relationship with SubClassB. That test application doesn't have a circular reference (it's two concrete entities connected by a many to many relationship). Both entities extend the same abstract class though... It's similar to the self referencing issue fixed earlier

luispabon commented 8 years ago

This is happening even with no fixtures to load.