Path

ez components / documentation / api reference / 2007.2.1 / persistentobject


eZ Components 2007.2.1

PersistentObject: ezcPersistentSessionInstance

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcPersistentSessionInstance

Holds persistent object session instances for global access throughout an application. [source]
Typical usage example:
 1.  $session new ezcPersistentSessionezcDbInstance::get(),
 2.                                        new ezcPersistentCodeManager... ) );
 3.  ezcPersistentSessionInstance::set$session )// set default session
 4.   $session2 new ezcPersistentSessionezcDbInstance::get'other_db' ),
 5.                                        new ezcPersistentCodeManager... ) );
 6.  ezcPersistentSessionInstance::set$session2'extra' )// set the extra session
 7.  
 8.  // retrieve the sessions
 9.   $session ezcPersistentSessionInstance::get();
10.  $session2 ezcPersistentSessionInstance::get'extra' );

Method Summary

public static void chooseDefault( $identifier )
Sets the database $identifier as default database instance.
public static ezcPersistentSession get( [$identifier = null] )
Returns the persistent session instance named $identifier.
public void reset( )
Resets this object to its initial state.
public static void resetDefault( )
Resets the default instance holder.
public static void set( $session, [$identifier = null] )
Adds the persistent session $session to the list of known instances.

Methods

chooseDefault

void chooseDefault( string $identifier )
Sets the database $identifier as default database instance.
To retrieve the default database instance call get() with no parameters..

Parameters

Name Type Description
$identifier string  

See also:

ezcPersistentSessionInstance::get()..


get

ezcPersistentSession get( [string $identifier = null] )
Returns the persistent session instance named $identifier.
If $identifier is ommited the default persistent session specified by chooseDefault() is returned.

Parameters

Name Type Description
$identifier string  

Throws

ClassDescription
ezcPersistentSessionNotFoundException if the specified instance is not found.

reset

void reset( )
Resets this object to its initial state.

resetDefault

void resetDefault( )
Resets the default instance holder.

set

void set( ezcPersistentSession $session, [string $identifier = null] )
Adds the persistent session $session to the list of known instances.
If $identifier is specified the persistent session instance can be retrieved later using the same identifier. If $identifier is ommited the default instance will be set.

Parameters

Name Type Description
$session ezcPersistentSession  
$identifier string the identifier of the database handler

Last updated: Thu, 31 Jan 2008