/** * @param null $document * @return Document|null */ public static function instantiate($document = null) { /** @var DocumentInterface $model */ $model = parent::instantiate(); foreach ($document as $attr => $value) { if ($model->hasAttribute($attr)) { $model->{$attr} = $value; } } //$model->commit(); //static::getCollection()->addToIdentityMap($model); return $model; }
public function __construct($attributes = null) { parent::__construct($attributes); $this->setIsNew(true); }