Ejemplo n.º 1
0
 /**
  * @param UuidInterface $eventId
  * @return int
  */
 private function getRowIdByEventId(UuidInterface $eventId)
 {
     static $lastEventId, $lastRowId;
     if ($eventId->equals($lastEventId)) {
         return $lastRowId;
     }
     $sql = "SELECT id FROM {$this->table} WHERE event_id = ? LIMIT 1";
     $stmt = $this->connection->prepare($sql);
     $stmt->bindValue(1, (string) $eventId, Type::STRING);
     $stmt->execute();
     $rowId = $stmt->fetchColumn();
     if (false === $rowId) {
         throw new OutOfBoundsException(sprintf('Record for event %s not found', $eventId));
     }
     $lastEventId = $eventId;
     $lastRowId = (int) $rowId;
     return $lastRowId;
 }