doctrine / data-fixtures

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

Problem with ORMPurge and dependencyList #244

Closed skjaro closed 8 years ago

skjaro commented 8 years ago

There is bug in getCommitOrder which adds multiple times same node which clears dependencyList in TopologicalSorter instance.

    foreach ($classes as $class) {
        $sorter->addNode($class->name, $class);

should be:

    foreach ($classes as $class) {
        if ( ! $sorter->hasNode($class->name))
                $sorter->addNode($class->name, $class);

becouse code bellow already adds class in associationMappings:

                if ( ! $sorter->hasNode($targetClassName)) {
                    $sorter->addNode($targetClassName, $targetClass);
                }

                // add dependency ($targetClass before $class)
                $sorter->addDependency($targetClassName, $class->name);
mikeSimonson commented 8 years ago

@skjaro Can you make a test case and a PR for it ?

skjaro commented 8 years ago

I will try, but I look at pull request #240 there is already fixed this issue.

skjaro commented 8 years ago

Definitely, #240 fix my issue. I tested it today, please merge.

mikeSimonson commented 8 years ago

closed by #240