예제 #1
0
 /**
  * @param TodoWasReopened $event
  */
 public function onTodoWasReopened(TodoWasReopened $event)
 {
     $this->connection->update(Table::TODO, ['status' => $event->status()->toString()], ['id' => $event->todoId()->toString()]);
 }
예제 #2
0
 /**
  * @param TodoWasReopened $event
  */
 protected function whenTodoWasReopened(TodoWasReopened $event)
 {
     $this->status = $event->status();
 }
예제 #3
0
 /**
  * @param TodoWasReopened $event
  * @throws UserNotFound if data of the the assigned user can not be found
  */
 public function onTodoWasReopened(TodoWasReopened $event)
 {
     $user = $this->userFinder->findUserOfTodo($event->todoId()->toString());
     if (!$user) {
         throw new UserNotFound(sprintf("Data of the assigned user of the todo %s cannot be found", $event->todoId()->toString()));
     }
     $stmt = $this->connection->prepare(sprintf('UPDATE %s SET open_todos = open_todos + 1, done_todos = done_todos - 1 WHERE id = :assignee_id', Table::USER));
     $stmt->bindValue('assignee_id', $user->id);
     $stmt->execute();
 }