Mongolid\Model\Relations::embed PHP Method

embed() public method

Embed a new document to an attribute. It will also generate an _id for the document if it's not present.
public embed ( string $field, mixed &$obj ) : void
$field string Field to where the $obj will be embedded.
$obj mixed Document or model instance.
return void
    public function embed(string $field, &$obj)
    {
        $embedder = Ioc::make(DocumentEmbedder::class);
        $embedder->embed($this, $field, $obj);
    }