Exemplo n.º 1
0
 /**
  * 생성자
  *
  * @param array $attributes 회원정보
  */
 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
 }
 /**
  * 주어진 entity 정보를 database에 업데이트한다.
  *
  * @param Entity $entity 업데이트할 정보
  *
  * @return Entity
  */
 public function update($entity)
 {
     if ($entity->id === null) {
         throw new IDNotFoundException();
     }
     $data = $entity->diff();
     if (count($data) > 0) {
         $data['updatedAt'] = $this->getCurrentTime();
         $this->table()->where('id', $entity->id)->update($data);
         $entity->updatedAt = $data['updatedAt'];
     }
     $entity->syncOriginal();
     return $entity;
 }