Skip to content

Timestamps not hydrated on embedded models #595

Open
@Rezouce

Description

@Rezouce
<?php
class Model extends \Jenssegers\Mongodb\Model
{
    public function association()
    {
        return $this->embedsMany('ModelChild');
    }
}

class ModelChild extends \Jenssegers\Mongodb\Model
{
}

$model = new Model;
$child = new ChildModel;

$model->association()->associate($child);
$model->save(); // The child's timestamps ARE NOT hydrated


$model = new Model;
$child = new ChildModel;

$model->save();
$model->association()->save($child); // The child's timestamps ARE hydrated

The result should have been the same regardless the way we saved the model (preferably, the timestamps should be there is both cases).

Metadata

Metadata

Assignees

No one assigned

    Labels

    relationsRelations between documents

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions