API Documentation

Zend/Session/SaveHandler/DbTable.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-webat this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Session  
Version
$Id: DbTable.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Session_SaveHandler_DbTable

Package: Zend\Session\SaveHandler

Zend_Session_SaveHandler_DbTable

Implements
\Zend_Session_SaveHandler_Interface
Parent(s)
\Zend_Db_Table_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  PRIMARY_ASSIGNMENT = 'primaryAssignment'
Constant  PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH = 'sessionSavePath'
Constant  PRIMARY_ASSIGNMENT_SESSION_NAME = 'sessionName'
Constant  PRIMARY_ASSIGNMENT_SESSION_ID = 'sessionId'
Constant  MODIFIED_COLUMN = 'modifiedColumn'
Constant  LIFETIME_COLUMN = 'lifetimeColumn'
Constant  DATA_COLUMN = 'dataColumn'
Constant  LIFETIME = 'lifetime'
Constant  OVERRIDE_LIFETIME = 'overrideLifetime'
Constant  PRIMARY_TYPE_NUM = 'PRIMARY_TYPE_NUM'
Constant  PRIMARY_TYPE_PRIMARYNUM = 'PRIMARY_TYPE_PRIMARYNUM'
Constant  PRIMARY_TYPE_ASSOC = 'PRIMARY_TYPE_ASSOC'
Constant  PRIMARY_TYPE_WHERECLAUSE = 'PRIMARY_TYPE_WHERECLAUSE'

Properties

Propertyprotectedstring  $_dataColumn= 'null'

Session table data column

Default valuenullDetails
Type
string
Propertyprotectedint  $_lifetime= 'false'

Session lifetime

Default valuefalseDetails
Type
int
Propertyprotectedstring  $_lifetimeColumn= 'null'

Session table lifetime column

Default valuenullDetails
Type
string
Propertyprotectedstring  $_modifiedColumn= 'null'

Session table last modification time column

Default valuenullDetails
Type
string
Propertyprotectedboolean  $_overrideLifetime= 'false'

Whether or not the lifetime of an existing session should be overridden

Default valuefalseDetails
Type
boolean
Propertyprotectedarray  $_primaryAssignment= 'null'

Session table primary key value assignment

Default valuenullDetails
Type
array
Propertyprotectedstring  $_sessionName= ''

Session name

Details
Type
string
Propertyprotectedstring  $_sessionSavePath= ''

Session save path

Details
Type
string

Methods

methodpublic__construct( \Zend_Config|array $config ) : void

Constructor

$config is an instance of Zend_Config or an array of key/value pairs containing configuration options for Zend_Session_SaveHandler_DbTable and Zend_Db_Table_Abstract. These are the configuration options for Zend_Session_SaveHandler_DbTable:

primaryAssignment => (string|array) Session table primary key value assignment (optional; default: 1 => sessionId) You have to assign a value to each primary key of your session table. The value of this configuration option is either a string if you have only one primary key or an array if you have multiple primary keys. The array consists of numeric keys starting at 1 and string values. There are some values which will be replaced by session information:

 sessionId       => The id of the current session
 sessionName     => The name of the current session
 sessionSavePath => The save path of the current session

 NOTE: One of your assignments MUST contain 'sessionId' as value!

modifiedColumn => (string) Session table last modification time column

lifetimeColumn => (string) Session table lifetime column

dataColumn => (string) Session table data column

lifetime => (integer) Session lifetime (optional; default: ini_get('session.gc_maxlifetime'))

overrideLifetime => (boolean) Whether or not the lifetime of an existing session should be overridden (optional; default: false)

Parameters
Name Type Description
$config \Zend_Config|array

User-provided configuration

Throws
Exception Description
\Zend_Session_SaveHandler_Exception
methodpublic__destruct( ) : void

Destructor

methodprotected_checkRequiredColumns( ) : void

Check for required session table columns

Throws
Exception Description
\Zend_Session_SaveHandler_Exception
methodprotected_getExpirationTime( \Zend_Db_Table_Row_Abstract $row ) : int

Retrieve session expiration time

Parameters
Name Type Description
$row \Zend_Db_Table_Row_Abstract
Returns
Type Description
int
methodprotected_getLifetime( \Zend_Db_Table_Row_Abstract $row ) : int

Retrieve session lifetime considering Zend_Session_SaveHandler_DbTable::OVERRIDE_LIFETIME

Parameters
Name Type Description
$row \Zend_Db_Table_Row_Abstract
Returns
Type Description
int
methodprotected_getPrimary( string $id, string $type = null ) : array

Retrieve session table primary key values

Parameters
Name Type Description
$id string
$type string

(optional; default: self::PRIMARY_TYPE_NUM)

Returns
Type Description
array
methodprotected_setup( ) : void

Calls other protected methods for individual setup tasks and requirement checks

methodprotected_setupPrimaryAssignment( ) : void

Initialize session table primary key value assignment

Throws
Exception Description
\Zend_Session_SaveHandler_Exception
methodprotected_setupTableName( ) : void

Initialize table and schema names

Throws
Exception Description
\Zend_Session_SaveHandler_Exception
methodpublicclose( ) : boolean

Close session

Returns
Type Description
boolean
methodpublicdestroy( string $id ) : boolean

Destroy session

Parameters
Name Type Description
$id string
Returns
Type Description
boolean
methodpublicgc( int $maxlifetime ) : true

Garbage Collection

Parameters
Name Type Description
$maxlifetime int
Returns
Type Description
true
methodpublicgetLifetime( ) : int

Retrieve session lifetime

Returns
Type Description
int
methodpublicgetOverrideLifetime( ) : boolean

Retrieve whether or not the lifetime of an existing session should be overridden

Returns
Type Description
boolean
methodpublicopen( string $save_path, string $name ) : boolean

Open Session

Parameters
Name Type Description
$save_path string
$name string
Returns
Type Description
boolean
methodpublicread( string $id ) : string

Read session data

Parameters
Name Type Description
$id string
Returns
Type Description
string
methodpublicsetLifetime( int $lifetime, boolean $overrideLifetime = null ) : \Zend_Session_SaveHandler_DbTable

Set session lifetime and optional whether or not the lifetime of an existing session should be overridden

$lifetime === false resets lifetime to session.gc_maxlifetime

Parameters
Name Type Description
$lifetime int
$overrideLifetime boolean

(optional)

Returns
Type Description
\Zend_Session_SaveHandler_DbTable
methodpublicsetOverrideLifetime( boolean $overrideLifetime ) : \Zend_Session_SaveHandler_DbTable

Set whether or not the lifetime of an existing session should be overridden

Parameters
Name Type Description
$overrideLifetime boolean
Returns
Type Description
\Zend_Session_SaveHandler_DbTable
methodpublicwrite( string $id, string $data ) : boolean

Write session data

Parameters
Name Type Description
$id string
$data string
Returns
Type Description
boolean
Documentation was generated by DocBlox 0.15.1.