Example #1
0
 /**
  * @param TodoWasPosted $event
  */
 protected function whenTodoWasPosted(TodoWasPosted $event)
 {
     $this->todoId = $event->todoId();
     $this->assigneeId = $event->assigneeId();
     $this->text = $event->text();
     $this->status = $event->todoStatus();
 }
 /**
  * @param TodoWasPosted $event
  */
 public function onTodoWasPosted(TodoWasPosted $event)
 {
     $this->connection->insert(Table::TODO, ['id' => $event->todoId()->toString(), 'assignee_id' => $event->assigneeId()->toString(), 'text' => $event->text(), 'status' => $event->todoStatus()->toString()]);
 }
 /**
  * Increases the open_todos counter of the assignee by one
  *
  * @param TodoWasPosted $event
  */
 public function onTodoWasPosted(TodoWasPosted $event)
 {
     $stmt = $this->connection->prepare(sprintf('UPDATE %s SET open_todos = open_todos + 1 WHERE id = :assignee_id', Table::USER));
     $stmt->bindValue('assignee_id', $event->assigneeId()->toString());
     $stmt->execute();
 }