Skip to content

Commit

Permalink
Update fuel/application/core/MY_Model.php
Browse files Browse the repository at this point in the history
  • Loading branch information
David McReynolds committed Nov 7, 2012
1 parent b3bef76 commit 25c0cea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fuel/application/core/MY_Model.php
Expand Up @@ -995,8 +995,10 @@ public function save($record = NULL, $validate = TRUE, $ignore_on_insert = TRUE)
$this->db->insert_ignore($this->table_name, $values, $insert_key);

// execute on_insert/update hook methods
$no_key = FALSE;
if (!$this->_has_key_field_value($values) AND $this->db->insert_id())
{
$no_key = TRUE;
if (is_string($this->key_field))
{
$values[$this->key_field] = $this->db->insert_id();
Expand All @@ -1011,7 +1013,7 @@ public function save($record = NULL, $validate = TRUE, $ignore_on_insert = TRUE)
// execute on_insert/update hook methods on the Date_record model if exists
if (is_object($record) AND is_a($record, 'Data_record'))
{
if (!$this->_has_key_field_value($values) AND $this->db->insert_id())
if ($no_key)
{
$record->on_after_insert($values);
}
Expand Down

0 comments on commit 25c0cea

Please sign in to comment.