Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Session_SaveHandler_DbTable Class Reference

Public Member Functions

 __construct ($config)
 Constructor.
 
 __destruct ()
 Destructor.
 
 setLifetime ($lifetime, $overrideLifetime=null)
 Set session lifetime and optional whether or not the lifetime of an existing session should be overridden.
 
 getLifetime ()
 Retrieve session lifetime.
 
 setOverrideLifetime ($overrideLifetime)
 Set whether or not the lifetime of an existing session should be overridden.
 
 getOverrideLifetime ()
 Retrieve whether or not the lifetime of an existing session should be overridden.
 
 open ($save_path, $name)
 Open Session.
 
 close ()
 Close session.
 
 read ($id)
 Read session data.
 
 write ($id, $data)
 Write session data.
 
 destroy ($id)
 Destroy session.
 
 gc ($maxlifetime)
 Garbage Collection.
 
- Public Member Functions inherited from Zend_Db_Table_Abstract
 __construct ($config=array())
 Constructor.
 
 setOptions (Array $options)
 setOptions()
 
 setDefinition (Zend_Db_Table_Definition $definition)
 setDefinition()
 
 getDefinition ()
 getDefinition()
 
 setDefinitionConfigName ($definitionConfigName)
 setDefinitionConfigName()
 
 getDefinitionConfigName ()
 getDefinitionConfigName()
 
 setRowClass ($classname)
 
 getRowClass ()
 
 setRowsetClass ($classname)
 
 getRowsetClass ()
 
 addReference ($ruleKey, $columns, $refTableClass, $refColumns, $onDelete=null, $onUpdate=null)
 Add a reference to the reference map.
 
 setReferences (array $referenceMap)
 
 getReference ($tableClassname, $ruleKey=null)
 
 setDependentTables (array $dependentTables)
 
 getDependentTables ()
 
 setDefaultSource ($defaultSource=self::DEFAULT_NONE)
 set the defaultSource property - this tells the table class where to find default values
 
 getDefaultSource ()
 returns the default source flag that determines where defaultSources come from
 
 setDefaultValues (Array $defaultValues)
 set the default values for the table class
 
 getDefaultValues ()
 
 getAdapter ()
 Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
 
 getMetadataCache ()
 Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
 
 setMetadataCacheInClass ($flag)
 Indicate whether metadata should be cached in the class for the duration of the instance.
 
 metadataCacheInClass ()
 Retrieve flag indicating if metadata should be cached for duration of instance.
 
 init ()
 Initialize object.
 
 info ($key=null)
 Returns table information.
 
 select ($withFromPart=self::SELECT_WITHOUT_FROM_PART)
 Returns an instance of a Zend_Db_Table_Select object.
 
 insert (array $data)
 Inserts a new row.
 
 isIdentity ($column)
 Check if the provided column is an identity of the table.
 
 update (array $data, $where)
 Updates existing rows.
 
 _cascadeUpdate ($parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey)
 Called by a row object for the parent table's class during save() method.
 
 delete ($where)
 Deletes existing rows.
 
 _cascadeDelete ($parentTableClassname, array $primaryKey)
 Called by parent table's class during delete() method.
 
 find ()
 Fetches rows by primary key.
 
 fetchAll ($where=null, $order=null, $count=null, $offset=null)
 Fetches all rows.
 
 fetchRow ($where=null, $order=null, $offset=null)
 Fetches one row in an object of type Zend_Db_Table_Row_Abstract, or returns null if no row matches the specified criteria.
 
 fetchNew ()
 Fetches a new blank row (not from the database).
 
 createRow (array $data=array(), $defaultSource=null)
 Fetches a new blank row (not from the database).
 

Public Attributes

const PRIMARY_ASSIGNMENT = 'primaryAssignment'
 
const PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH = 'sessionSavePath'
 
const PRIMARY_ASSIGNMENT_SESSION_NAME = 'sessionName'
 
const PRIMARY_ASSIGNMENT_SESSION_ID = 'sessionId'
 
const MODIFIED_COLUMN = 'modifiedColumn'
 
const LIFETIME_COLUMN = 'lifetimeColumn'
 
const DATA_COLUMN = 'dataColumn'
 
const LIFETIME = 'lifetime'
 
const OVERRIDE_LIFETIME = 'overrideLifetime'
 
const PRIMARY_TYPE_NUM = 'PRIMARY_TYPE_NUM'
 
const PRIMARY_TYPE_PRIMARYNUM = 'PRIMARY_TYPE_PRIMARYNUM'
 
const PRIMARY_TYPE_ASSOC = 'PRIMARY_TYPE_ASSOC'
 
const PRIMARY_TYPE_WHERECLAUSE = 'PRIMARY_TYPE_WHERECLAUSE'
 
- Public Attributes inherited from Zend_Db_Table_Abstract
const ADAPTER = 'db'
 
const DEFINITION = 'definition'
 
const DEFINITION_CONFIG_NAME = 'definitionConfigName'
 
const SCHEMA = 'schema'
 
const NAME = 'name'
 
const PRIMARY = 'primary'
 
const COLS = 'cols'
 
const METADATA = 'metadata'
 
const METADATA_CACHE = 'metadataCache'
 
const METADATA_CACHE_IN_CLASS = 'metadataCacheInClass'
 
const ROW_CLASS = 'rowClass'
 
const ROWSET_CLASS = 'rowsetClass'
 
const REFERENCE_MAP = 'referenceMap'
 
const DEPENDENT_TABLES = 'dependentTables'
 
const SEQUENCE = 'sequence'
 
const COLUMNS = 'columns'
 
const REF_TABLE_CLASS = 'refTableClass'
 
const REF_COLUMNS = 'refColumns'
 
const ON_DELETE = 'onDelete'
 
const ON_UPDATE = 'onUpdate'
 
const CASCADE = 'cascade'
 
const CASCADE_RECURSE = 'cascadeRecurse'
 
const RESTRICT = 'restrict'
 
const SET_NULL = 'setNull'
 
const DEFAULT_NONE = 'defaultNone'
 
const DEFAULT_CLASS = 'defaultClass'
 
const DEFAULT_DB = 'defaultDb'
 
const SELECT_WITH_FROM_PART = true
 
const SELECT_WITHOUT_FROM_PART = false
 

Protected Member Functions

 _setup ()
 Calls other protected methods for individual setup tasks and requirement checks.
 
 _setupTableName ()
 Initialize table and schema names.
 
 _setupPrimaryAssignment ()
 Initialize session table primary key value assignment.
 
 _checkRequiredColumns ()
 Check for required session table columns.
 
 _getPrimary ($id, $type=null)
 Retrieve session table primary key values.
 
 _getLifetime (Zend_Db_Table_Row_Abstract $row)
 Retrieve session lifetime considering Zend_Session_SaveHandler_DbTable::OVERRIDE_LIFETIME.
 
 _getExpirationTime (Zend_Db_Table_Row_Abstract $row)
 Retrieve session expiration time.
 
- Protected Member Functions inherited from Zend_Db_Table_Abstract
 _setAdapter ($db)
 
 _setMetadataCache ($metadataCache)
 Sets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
 
 _setSequence ($sequence)
 Sets the sequence member, which defines the behavior for generating primary key values in new rows.
 
 _setup ()
 Turnkey for initialization of a table object.
 
 _setupDatabaseAdapter ()
 Initialize database adapter.
 
 _setupTableName ()
 Initialize table and schema names.
 
 _setupMetadata ()
 Initializes metadata.
 
 _getCols ()
 Retrieve table columns.
 
 _setupPrimaryKey ()
 Initialize primary key from metadata.
 
 _getReferenceMapNormalized ()
 Returns a normalized version of the reference map.
 
 _where (Zend_Db_Table_Select $select, $where)
 Generate WHERE clause from user-supplied string or array.
 
 _order (Zend_Db_Table_Select $select, $order)
 Generate ORDER clause from user-supplied string or array.
 
 _fetch (Zend_Db_Table_Select $select)
 Support method for fetching rows.
 

Protected Attributes

 $_primaryAssignment = null
 
 $_modifiedColumn = null
 
 $_lifetimeColumn = null
 
 $_dataColumn = null
 
 $_lifetime = false
 
 $_overrideLifetime = false
 
 $_sessionSavePath
 
 $_sessionName
 
- Protected Attributes inherited from Zend_Db_Table_Abstract
 $_definition = null
 
 $_definitionConfigName = null
 
 $_db
 
 $_schema = null
 
 $_name = null
 
 $_cols
 
 $_primary = null
 
 $_identity = 1
 
 $_sequence = true
 
 $_metadata = array()
 
 $_metadataCache = null
 
 $_metadataCacheInClass = true
 
 $_rowClass = 'Zend_Db_Table_Row'
 
 $_rowsetClass = 'Zend_Db_Table_Rowset'
 
 $_referenceMap = array()
 
 $_dependentTables = array()
 
 $_defaultSource = self::DEFAULT_NONE
 
 $_defaultValues = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Db_Table_Abstract
static setDefaultAdapter ($db=null)
 Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
 
static getDefaultAdapter ()
 Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
 
static setDefaultMetadataCache ($metadataCache=null)
 Sets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
 
static getDefaultMetadataCache ()
 Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
 
static getTableFromString ($tableName, Zend_Db_Table_Abstract $referenceTable=null)
 
- Static Protected Member Functions inherited from Zend_Db_Table_Abstract
static _setupAdapter ($db)
 
static _setupMetadataCache ($metadataCache)
 
- Static Protected Attributes inherited from Zend_Db_Table_Abstract
static $_defaultDb
 
static $_defaultMetadataCache = null
 

Constructor & Destructor Documentation

__construct (   $config)

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
Zend_Config | array$configUser-provided configuration
Returns
void
Exceptions
Zend_Session_SaveHandler_Exception
See Also
Zend_Session_SaveHandler_Exception
__destruct ( )

Destructor.

Returns
void

Member Function Documentation

_checkRequiredColumns ( )
protected
_getExpirationTime ( Zend_Db_Table_Row_Abstract  $row)
protected

Retrieve session expiration time.

Parameters
Zend_Db_Table_Row_Abstract$row
Returns
int
_getLifetime ( Zend_Db_Table_Row_Abstract  $row)
protected

Retrieve session lifetime considering Zend_Session_SaveHandler_DbTable::OVERRIDE_LIFETIME.

Parameters
Zend_Db_Table_Row_Abstract$row
Returns
int
_getPrimary (   $id,
  $type = null 
)
protected

Retrieve session table primary key values.

Parameters
string$id
string$type(optional; default: self::PRIMARY_TYPE_NUM)
Returns
array
_setup ( )
protected

Calls other protected methods for individual setup tasks and requirement checks.

Returns
void
_setupPrimaryAssignment ( )
protected

Initialize session table primary key value assignment.

Returns
void
Exceptions
Zend_Session_SaveHandler_Exception
See Also
Zend_Session_SaveHandler_Exception
Zend_Session_SaveHandler_Exception
_setupTableName ( )
protected

Initialize table and schema names.

Returns
void
Exceptions
Zend_Session_SaveHandler_Exception
See Also
Zend_Session_SaveHandler_Exception
close ( )

Close session.

Returns
boolean

Implements Zend_Session_SaveHandler_Interface.

destroy (   $id)

Destroy session.

Parameters
string$id
Returns
boolean

Implements Zend_Session_SaveHandler_Interface.

gc (   $maxlifetime)

Garbage Collection.

Parameters
int$maxlifetime
Returns
true

Implements Zend_Session_SaveHandler_Interface.

getLifetime ( )

Retrieve session lifetime.

Returns
int
getOverrideLifetime ( )

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

Returns
boolean
open (   $save_path,
  $name 
)

Open Session.

Parameters
string$save_path
string$name
Returns
boolean

Implements Zend_Session_SaveHandler_Interface.

read (   $id)

Read session data.

Parameters
string$id
Returns
string

Implements Zend_Session_SaveHandler_Interface.

setLifetime (   $lifetime,
  $overrideLifetime = null 
)

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
int$lifetime
boolean$overrideLifetime(optional)
Returns
Zend_Session_SaveHandler_DbTable
See Also
Zend_Session_SaveHandler_Exception
setOverrideLifetime (   $overrideLifetime)

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

Parameters
boolean$overrideLifetime
Returns
Zend_Session_SaveHandler_DbTable
write (   $id,
  $data 
)

Write session data.

Parameters
string$id
string$data
Returns
boolean

Implements Zend_Session_SaveHandler_Interface.

Member Data Documentation

$_dataColumn = null
protected
$_lifetime = false
protected
$_lifetimeColumn = null
protected
$_modifiedColumn = null
protected
$_overrideLifetime = false
protected
$_primaryAssignment = null
protected
$_sessionName
protected
$_sessionSavePath
protected
const DATA_COLUMN = 'dataColumn'
const LIFETIME = 'lifetime'
const LIFETIME_COLUMN = 'lifetimeColumn'
const MODIFIED_COLUMN = 'modifiedColumn'
const OVERRIDE_LIFETIME = 'overrideLifetime'
const PRIMARY_ASSIGNMENT = 'primaryAssignment'
const PRIMARY_ASSIGNMENT_SESSION_ID = 'sessionId'
const PRIMARY_ASSIGNMENT_SESSION_NAME = 'sessionName'
const PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH = 'sessionSavePath'
const PRIMARY_TYPE_ASSOC = 'PRIMARY_TYPE_ASSOC'
const PRIMARY_TYPE_NUM = 'PRIMARY_TYPE_NUM'
const PRIMARY_TYPE_PRIMARYNUM = 'PRIMARY_TYPE_PRIMARYNUM'
const PRIMARY_TYPE_WHERECLAUSE = 'PRIMARY_TYPE_WHERECLAUSE'