diff --git a/composer.json b/composer.json index 0dc9080..7831ab8 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "require": { - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "4.2.*", "mockery/mockery": ">=0.7.2" }, "autoload": { "classmap": [ "core", "tests/support/models" ] } -} \ No newline at end of file +} diff --git a/core/MY_Model.php b/core/MY_Model.php index 05add98..e93a7cb 100644 --- a/core/MY_Model.php +++ b/core/MY_Model.php @@ -206,6 +206,8 @@ public function get_all() */ public function insert($data, $skip_validation = FALSE) { + $data = $this->trigger('before_create', $data); + if ($skip_validation === FALSE) { $data = $this->validate($data); @@ -213,8 +215,6 @@ public function insert($data, $skip_validation = FALSE) if ($data !== FALSE) { - $data = $this->trigger('before_create', $data); - $this->_database->insert($this->_table, $data); $insert_id = $this->_database->insert_id();