From 59a7d6c59a0442cbc6a179af5be197a48c443ec7 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Mon, 15 Sep 2014 09:04:59 +0800 Subject: [PATCH 1/2] update phpunit version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +} From 0e781d779df05027a2e432ca88c0bcb9571ddceb Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Mon, 15 Sep 2014 09:08:54 +0800 Subject: [PATCH 2/2] move before_create trigger to beginning of method --- core/MY_Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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();