Xpressengine\Draft\DraftRepository::update PHP Méthode

update() public méthode

임시저장 데이터를 수정
public update ( DraftEntity $draft ) : DraftEntity
$draft DraftEntity 임시저장 객체
Résultat DraftEntity
    public function update(DraftEntity $draft)
    {
        $diff = array_merge($draft->getDirty(), ['createdAt' => date('Y-m-d H:i:s')]);
        $this->conn->table($this->table)->where('id', $draft->id)->update($diff);
        return $this->createItem(array_merge($draft->getOriginal(), $diff));
    }

Usage Example

 /**
  * 임시저장 데이터 갱신
  *
  * @param string $id  임시저장 아이디
  * @param string $val 갱신될 data 값
  * @param array  $etc 기타 값들
  * @return DraftEntity
  */
 public function put($id, $val, array $etc = [])
 {
     if (($draft = $this->getById($id)) === null) {
         return null;
     }
     $draft->val = $val;
     $draft->etc = serialize($etc);
     return $this->repo->update($draft);
 }
All Usage Examples Of Xpressengine\Draft\DraftRepository::update