Example #1
0
 /**
  * @param TodoWasUnmarkedAsExpired $event
  */
 public function onTodoWasUnmarkedAsExpired(TodoWasUnmarkedAsExpired $event)
 {
     $this->connection->update(Table::TODO, ['status' => $event->newStatus()->toString()], ['id' => $event->todoId()->toString()]);
 }
Example #2
0
 /**
  * @param TodoWasUnmarkedAsExpired $event
  */
 protected function whenTodoWasUnmarkedAsExpired(TodoWasUnmarkedAsExpired $event)
 {
     $this->status = $event->newStatus();
 }
Example #3
0
 /**
  * @param TodoWasUnmarkedAsExpired $event
  * @throws UserNotFound if data of the the assigned user can not be found
  */
 public function onTodoWasUnmarkedAsExpired(TodoWasUnmarkedAsExpired $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, expired_todos = expired_todos - 1 WHERE id = :assignee_id', Table::USER));
     $stmt->bindValue('assignee_id', $user->id);
     $stmt->execute();
 }