SymfonyComponentHttpFoundationSessionStorageHandlerPdoSessionHandler

PdoSessionHandler.

Summary

No public properties found
No constants found
No protected methods found
No protected properties found
N/A
File
vendorSymfonyComponentHttpFoundationSessionStorageHandlerPdoSessionHandler.php
Package
Default
Class hierarchy
SymfonyComponentHttpFoundationSessionStorageHandlerPdoSessionHandler
Implements
SessionHandlerInterface

Tags

author

Fabien Potencier fabien@symfony.com

Michael Williams michael.williams@funsational.com

Properties

$pdo

$pdo : \PDO

Type

PDO — PDO instance.

Tags

None found

$dbOptions

$dbOptions : array

Type

array — Database options.

Tags

None found

Methods

__construct()

__construct(\PDO  $pdo, array  $dbOptions = array()) 

Constructor.

List of available options:

  • db_table: The name of the table [required]
  • db_id_col: The column where to store the session id [default: sess_id]
  • db_data_col: The column where to store the session data [default: sess_data]
  • db_time_col: The column where to store the timestamp [default: sess_time]

Parameters

PDO $pdo

A PDO instance

array $dbOptions

An associative array of DB options

Throws

InvalidArgumentException

When "db_table" option is not provided

Tags

None found

open()

open(  $path,   $name) : boolean

Open session.

Parameters

$path
$name

Returns

boolean

Tags

None found

close()

close() : boolean

Close session.

Returns

boolean

Tags

None found

destroy()

destroy(  $id) : boolean

Destroys this session.

Parameters

$id

Returns

boolean

Tags

None found

gc()

gc(integer  $lifetime) : boolean

Garbage collection for storage.

Parameters

integer $lifetime

Max lifetime in seconds to keep sessions stored.

Returns

boolean

Tags

None found

read()

read(  $id) : string

Read session.

Parameters

$id

Returns

string —

String as stored in persistent storage or empty string in all other cases.

Tags

None found

write()

write(  $id, string  $data) : boolean

Commit session to storage.

Parameters

$id
string $data

Session serialized data to save.

Returns

boolean

Tags

None found

createNewSession()

createNewSession(string  $id, string  $data = '') : boolean

Creates a new session with the given $id and $data

Parameters

string $id
string $data

Returns

boolean —

True.

Tags

None found