Skip to content

Commit

Permalink
fixing: disabling foreign_key check in before method
Browse files Browse the repository at this point in the history
  • Loading branch information
koddistortion committed Dec 9, 2016
1 parent 8ba4267 commit 8ecd794
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/StingerSoft/DoctrineCommons/Utils/JsonImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ public function import($filename) {
* Executed before the import is started
*/
protected function before() {

if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->connection->executeUpdate('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"');
} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->connection->executeUpdate('SET FOREIGN_KEY_CHECKS=0');
} else if($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
$this->connection->executeUpdate('PRAGMA foreign_keys = OFF');
}
}

/**
Expand Down

0 comments on commit 8ecd794

Please sign in to comment.