예제 #1
0
파일: Update.php 프로젝트: harp-orm/harp
 public function model(AbstractModel $model)
 {
     $data = $model->getChanges();
     $model->getRepo()->getSerializers()->serialize($data);
     $this->set($data)->where($model->getRepo()->getPrimaryKey(), $model->getId());
     return $this;
 }
예제 #2
0
 /**
  * @param  AbstractModel $model
  * @param  AbstractModel $foreign
  */
 public function updateInverse(AbstractModel $model, AbstractModel $foreign)
 {
     $link = $foreign->getLinkOne($this->getName());
     if ($link->get() !== $model) {
         $link->set($model);
     }
 }
예제 #3
0
 /**
  * @param  AbstractModel $model
  * @param  AbstractModel $foreign
  * @return boolean
  */
 public function areLinked(AbstractModel $model, AbstractModel $foreign)
 {
     return $model->getId() == $foreign->{$this->getThroughKey()};
 }
예제 #4
0
파일: LinkOne.php 프로젝트: harp-orm/harp
 /**
  * @return LinkOne $this
  */
 public function clear()
 {
     $this->current->setStateVoid();
     return $this;
 }