Skip to content

Instantly share code, notes, and snippets.

@emamut
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emamut/5000957be6d5756ac22b to your computer and use it in GitHub Desktop.
Save emamut/5000957be6d5756ac22b to your computer and use it in GitHub Desktop.
Fixture executioner in CI
<?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