예제 #1
0
파일: HasOne.php 프로젝트: harp-orm/harp
 public function update(LinkOne $link)
 {
     if ($link->isChanged()) {
         $link->get()->{$this->getForeignKey()} = $link->getModel()->{$this->getKey()};
         $link->getOriginal()->{$this->getForeignKey()} = null;
     }
 }
예제 #2
0
 /**
  * @covers ::clear
  */
 public function testClear()
 {
     $model = new Country();
     $link = new LinkOne(new City(), City::getRepo()->getRel('country'), $model);
     $link->clear();
     $this->assertTrue($link->get()->isVoid());
 }
예제 #3
0
 public function update(LinkOne $link)
 {
     $link->getModel()->{$this->key} = $link->get()->getId();
     $link->getModel()->{$this->classKey} = get_class($link->get());
 }
예제 #4
0
파일: BelongsTo.php 프로젝트: harp-orm/harp
 /**
  * @param  LinkOne       $link
  */
 public function update(LinkOne $link)
 {
     $link->getModel()->{$this->getKey()} = $link->get()->getId();
 }