示例#1
0
文件: Cache.php 项目: as3io/modlr
 /**
  * Pushes a model into the memory cache.
  *
  * @param   Model   $model
  * @return  self
  */
 public function push(Model $model)
 {
     $this->models[$model->getType()][$model->getId()] = $model;
     return $this;
 }
示例#2
0
文件: Model.php 项目: as3io/modlr
 /**
  * Sets a has-one relationship.
  *
  * @param   string      $key    The relationship key (field) name.
  * @param   Model|null  $model  The model to relate.
  * @return  self
  */
 protected function setHasOne($key, Model $model = null)
 {
     if (true === $this->isInverse($key)) {
         throw ModelException::cannotModifyInverse($this, $key);
     }
     if (null !== $model) {
         $this->validateRelSet($key, $model->getType());
     }
     $this->touch();
     $this->hasOneRelationships->set($key, $model);
     $this->doDirtyCheck();
     return $this;
 }