Exemple #1
0
 /**
  * @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;
 }
Exemple #2
0
 public function __construct($attributes = null)
 {
     parent::__construct($attributes);
     $this->setIsNew(true);
 }