You are here

public function LegacyPdoSessionHandler::destroy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php \Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHandler::destroy()

File

vendor/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php, line 114

Class

LegacyPdoSessionHandler
Session handler using a PDO connection to read and write data.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function destroy($sessionId) {

  // delete the record associated with this id
  $sql = "DELETE FROM {$this->table} WHERE {$this->idCol} = :id";
  try {
    $stmt = $this->pdo
      ->prepare($sql);
    $stmt
      ->bindParam(':id', $sessionId, \PDO::PARAM_STR);
    $stmt
      ->execute();
  } catch (\PDOException $e) {
    throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete a session: %s', $e
      ->getMessage()), 0, $e);
  }
  return true;
}