Skip to content

Commit

Permalink
Merge ae62146 into 84f1df5
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-butynski committed Mar 26, 2014
2 parents 84f1df5 + ae62146 commit 18146b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Jenssegers/Mongodb/Relations/EmbedsMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ protected function toCollection(array $results = array())

// Attatch the parent relation to the embedded model.
$model->setRelation($this->foreignKey, $this->parent);
$model->setHidden(array_merge($model->getHidden(), array($this->foreignKey)));

$models[] = $model;
}
Expand Down
1 change: 1 addition & 0 deletions tests/RelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ public function testEmbedsManySave()
$this->assertInstanceOf('DateTime', $address->created_at);
$this->assertInstanceOf('DateTime', $address->updated_at);
$this->assertInstanceOf('User', $address->user);
$this->assertEmpty($address->relationsToArray()); // prevent infinite loop

$user = User::find($user->_id);
$user->addresses()->save(new Address(array('city' => 'Bruxelles')));
Expand Down

0 comments on commit 18146b2

Please sign in to comment.