Commit ab64c586 authored by Jens Segers's avatar Jens Segers

Merge branch 'master' of github.com:jenssegers/Laravel-MongoDB

parents b32d35e3 f9287f52
...@@ -10,16 +10,16 @@ class DatabaseReminderRepository extends \Illuminate\Auth\Reminders\DatabaseRemi ...@@ -10,16 +10,16 @@ class DatabaseReminderRepository extends \Illuminate\Auth\Reminders\DatabaseRemi
*/ */
protected function reminderExpired($reminder) protected function reminderExpired($reminder)
{ {
// Convert to object so that we can pass it to the parent method // Convert to array so that we can pass it to the parent method
if (is_array($reminder)) if (is_object($reminder))
{ {
$reminder = (object) $reminder; $reminder = (array) $reminder;
} }
// Convert the DateTime object that got saved to MongoDB // Convert the DateTime object that got saved to MongoDB
if (is_array($reminder->created_at)) if (is_array($reminder['created_at']))
{ {
$reminder->created_at = $reminder->created_at['date'] + $reminder->created_at['timezone']; $reminder['created_at'] = $reminder['created_at']['date'] + $reminder['created_at']['timezone'];
} }
return parent::reminderExpired($reminder); return parent::reminderExpired($reminder);
......
...@@ -487,6 +487,7 @@ class EmbedsMany extends Relation { ...@@ -487,6 +487,7 @@ class EmbedsMany extends Relation {
// Attatch the parent relation to the embedded model. // Attatch the parent relation to the embedded model.
$model->setRelation($this->foreignKey, $this->parent); $model->setRelation($this->foreignKey, $this->parent);
$model->setHidden(array_merge($model->getHidden(), array($this->foreignKey)));
$models[] = $model; $models[] = $model;
} }
......
...@@ -337,6 +337,7 @@ class RelationsTest extends TestCase { ...@@ -337,6 +337,7 @@ class RelationsTest extends TestCase {
$this->assertInstanceOf('DateTime', $address->created_at); $this->assertInstanceOf('DateTime', $address->created_at);
$this->assertInstanceOf('DateTime', $address->updated_at); $this->assertInstanceOf('DateTime', $address->updated_at);
$this->assertInstanceOf('User', $address->user); $this->assertInstanceOf('User', $address->user);
$this->assertEmpty($address->relationsToArray()); // prevent infinite loop
$user = User::find($user->_id); $user = User::find($user->_id);
$user->addresses()->save(new Address(array('city' => 'Bruxelles'))); $user->addresses()->save(new Address(array('city' => 'Bruxelles')));
......
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