예제 #1
0
 /**
  * {@inheritDoc}
  */
 public function getIdentifiers($onlyUnloaded = true)
 {
     if (true === $this->loaded) {
         return [];
     }
     return [$this->owner->getId()];
 }
예제 #2
0
파일: Store.php 프로젝트: as3io/modlr
 /**
  * Determines if a model is eligible for commit.
  *
  * @todo    Does delete need to be here?
  * @param   Model   $model
  * @return  bool
  */
 protected function shouldCommit(Model $model)
 {
     $state = $model->getState();
     return true === $state->is('dirty') || $state->is('new') || $state->is('deleting');
 }
예제 #3
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;
 }
예제 #4
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;
 }