Doctrine\Common\DataFixtures\Sorter\TopologicalSorter::addDependency PHP Method

addDependency() public method

Adds a new dependency (edge) to the graph using their hashes.
public addDependency ( string $fromHash, string $toHash ) : void
$fromHash string
$toHash string
return void
    public function addDependency($fromHash, $toHash)
    {
        $definition = $this->nodeList[$fromHash];
        $definition->dependencyList[] = $toHash;
    }

Usage Example

 public function testFailureSortMissingDependency()
 {
     $node1 = new Mock\Node(1);
     $this->sorter->addNode('1', $node1);
     $this->sorter->addDependency('1', '2');
     $this->expectException(\RuntimeException::class);
     $this->sorter->sort();
 }
All Usage Examples Of Doctrine\Common\DataFixtures\Sorter\TopologicalSorter::addDependency