Skip to content
Permalink
Browse files

Disable foreign keys while fixtures are created/inserted.

  • Loading branch information...
markstory committed Sep 5, 2014
1 parent 1258319 commit 01e10425b063ee8ba72ee85e7bc26ad0996c1644
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/TestSuite/Fixture/FixtureManager.php
@@ -235,6 +235,7 @@ public function load($test) {
$db = ConnectionManager::get($fixture->connection, false);
$db->transactional(function($db) use ($fixtures, $test) {
$tables = $db->schemaCollection()->listTables();
$db->disableForeignKeys();
foreach ($fixtures as $fixture) {
if (!in_array($db->configName(), (array)$fixture->created)) {
$this->_setupTable($fixture, $db, $tables, $test->dropTables);
@@ -244,6 +245,7 @@ public function load($test) {
}
$fixture->insert($db);
}
$db->enableForeignKeys();
});
}
} catch (\PDOException $e) {

0 comments on commit 01e1042

Please sign in to comment.
You can’t perform that action at this time.