Skip to content
Aleksandar Jovanovic edited this page Apr 5, 2015 · 2 revisions

DbMockLibrary\DependencyHandler

DependencyHandler extends MockDataManipulation class and is therefore singleton as well. Features it provides are used by database implementations classes to manage dependencies between collections. Usage examples

For additional help, look at the tests, additional input scenarios are tested. initDependencyHandler(array $initialData, array $dependencies = [])

Initializes mock data & dependency data. Circular dependencies or dependencies that involve collections which were not defined in the dummy data, case exception to be thrown.

$dataArray    = [
            'foo1' => [ // collection
                'bar1' => [ // row
                    'baz1' => 1 // field
                ]
            ],
            'foo2' => [ // collection
                'bar2' => [ // row
                    'baz2' => 2 // field
                ]
            ]
        ];
$dependencies = [
            [
                DependencyHandler::DEPENDENT => ['foo1' => 'baz1'],
                DependencyHandler::ON        => ['foo2' => 'baz2']
            ]
        ];
DependencyHandler::initDependencyHandler($dataArray, $dependencies);