Example #1
0
 /**
  * @inheritDoc
  */
 public function persist(array $uncommittedEvents)
 {
     if (!method_exists($this->connection, 'insert')) {
         throw new \RuntimeException('The provided connection does not support inserting records using the "insert" method, please ' . 'choose a different connection type that does');
     }
     /** @var Stream\Event $event */
     foreach ($uncommittedEvents as $event) {
         $this->connection->insert($this->options[self::OPTION_TABLENAME], ['id' => (string) $event->id(), 'stream_id' => (string) $event->stream()->id(), 'sequence' => $event->sequence(), 'payload' => json_encode($event->payload()), 'emitted_at' => $event->emittedAt()->format('Y-m-d H:i:s')]);
     }
 }
 private function InsertInternal($id, $text)
 {
     $this->conn->insert('todo', ['id' => $id, 'todo' => $text, 'created' => time()]);
 }
 public function insert(Connection $conn, $id, $text)
 {
     $conn->insert('todo', ['id' => $id, 'todo' => $text, 'created' => time()]);
 }