Skip to content

Commit

Permalink
Check for inherited primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 6, 2016
1 parent c9d90b5 commit c71ab6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ActiveRecord.php
Expand Up @@ -160,10 +160,10 @@ public function save()
}

#
# Non auto-increment primary key
# Non auto-increment primary key, unless the key is inherited from parent model.
#

if ($primary && isset($properties[$primary])
if (!$model->parent && $primary && isset($properties[$primary])
&& !$model->extended_schema[$primary]->auto_increment)
{
return $model->insert($properties, [ 'on duplicate' => true ]);
Expand Down

0 comments on commit c71ab6a

Please sign in to comment.