Last active
August 29, 2015 14:01
-
-
Save emamut/5000957be6d5756ac22b to your computer and use it in GitHub Desktop.
Fixture executioner in CI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (! function_exists('fixture_executioner')) | |
{ | |
function fixture_executioner($fixture_path) | |
{ | |
$ci =& get_instance(); | |
$fixture_restore = $ci->load->file($fixture_path, true); | |
$fixture_array = explode(';', $fixture_restore); | |
foreach ($fixture_array as $query) | |
{ | |
$ci->db->query("SET FOREIGN_KEY_CHECKS = 0"); | |
$ci->db->query($query); | |
$ci->db->query("SET FOREIGN_KEY_CHECKS = 1"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment