Class SessionObject

Description

Represents an object that can be persisted in the session scope

A SessionObject instance contains a name, set of properties and a set of time counters. Once registered through the register() method, the object is saved in the session scope and can be updated when necessary through the update() method. The serialization and unserialization routines are totally transparent to the developer.

Located in /core/session/SessionObject.class.php (line 47)

PHP2Go
   |
   --SessionObject
Direct descendents
Class Description
User Base user container class
Variable Summary
string $name
array $properties
Method Summary
SessionObject SessionObject (string $name)
bool comparePropertyValue (string $name, mixed $compare, [bool $strict = FALSE])
void createProperty (string $name, [mixed $value = ''])
void createTimeCounter (string $name, [int $begin = 0])
void deleteProperty (string $name)
array getProperties ()
mixed getPropertyValue (string $name, [bool $throwError = TRUE])
mixed &getPropertyValueByRef (string $name, [bool $throwError = TRUE])
TimeCounter|bool &getTimeCounter (string $name, [bool $throwError = TRUE])
bool hasProperty (string $name)
bool isRegistered ()
bool register ()
void setPropertyValue (string $name, [mixed $value = ''])
bool unregister ()
void update ()
void _serialize ()
Variables
string $name (line 54)

Object name

array $properties = array() (line 68)

Object's properties

bool $registered = FALSE (line 61)

Whether the object is saved in the session

array $timeCounters = array() (line 75)

Object's time counters

Methods
Constructor SessionObject (line 86)

Class constructor

Search the given object name in the session scope. If it's found, restore all object's properties.

SessionObject SessionObject (string $name)
  • string $name: Object name
comparePropertyValue (line 216)

Compare the value of an object's property with another value

  • return: Equal/different
bool comparePropertyValue (string $name, mixed $compare, [bool $strict = FALSE])
  • string $name: Property name
  • mixed $compare: Compare value
  • bool $strict: Whether to use strict type comparison
createProperty (line 227)

Creates a new object property, or a set of properties

void createProperty (string $name, [mixed $value = ''])
  • string $name: Property name, or hash array of properties
  • mixed $value: Property value
createTimeCounter (line 276)

Creates a new time counter on the object

Time counters can be used to track time elapsed between actions performed by the application user.

void createTimeCounter (string $name, [int $begin = 0])
  • string $name: Time counter name
  • int $begin: Initial timestamp
deleteProperty (line 263)

Deletes an object property

void deleteProperty (string $name)
  • string $name: Property name
getProperties (line 171)

Get all object's properties

array getProperties ()
getPropertyValue (line 182)

Get the value of an object's property

mixed getPropertyValue (string $name, [bool $throwError = TRUE])
  • string $name: Property name
  • bool $throwError: Whether to throw an error when the property is not found

Redefined in descendants as:
  • User::getPropertyValue() : Overrides parent class implementation so that fetching inexistent properties return NULL instead of throwing an application error
getPropertyValueByRef (line 199)

Get an object's property by reference

mixed &getPropertyValueByRef (string $name, [bool $throwError = TRUE])
  • string $name: Property name
  • bool $throwError: Whether to throw an error when the property is not found
getTimeCounter (line 287)

Get a time counter by name

TimeCounter|bool &getTimeCounter (string $name, [bool $throwError = TRUE])
  • string $name: Time counter name
  • bool $throwError: Whether to throw an error when the time counter is not found
hasProperty (line 162)

Check if a given property exists

bool hasProperty (string $name)
  • string $name: Property name
isRegistered (line 112)

Check if the object is saved in the session

bool isRegistered ()
register (line 122)

Registers the object in the session scope

  • return: Success/failure
bool register ()
setPropertyValue (line 242)

Set an object's property, or a set of properties

void setPropertyValue (string $name, [mixed $value = ''])
  • string $name: Property name, or hash array of properties
  • mixed $value: Property value
unregister (line 136)

Removes the object from the session scope

  • return: Success/failure
bool unregister ()
update (line 152)

Synchronizes the object's properties in the session

It's recommended to call this method every time an object property is created, changed or removed, or when the script shuts down.

void update ()
_serialize (line 301)

Serializes the object and save it in the session scope

  • access: private
void _serialize ()

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:29:24 -0300 by phpDocumentor 1.3.2