Unverified Commit d795dac3 authored by jim5359's avatar jim5359 Committed by GitHub

EmbedsMany respect primaryKey on association

parent bc78c757
...@@ -236,7 +236,7 @@ class EmbedsMany extends EmbedsOneOrMany ...@@ -236,7 +236,7 @@ class EmbedsMany extends EmbedsOneOrMany
protected function associateNew($model) protected function associateNew($model)
{ {
// Create a new key if needed. // Create a new key if needed.
if (!$model->getAttribute('_id')) { if ($model->getKeyName() == '_id' && !$model->getAttribute('_id')) {
$model->setAttribute('_id', new ObjectID); $model->setAttribute('_id', new ObjectID);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment