Path

ez components / documentation / api reference / 2007.2beta1 / persistentobject


eZ Components 2007.2beta1

PersistentObject: ezcPersistentObjectDefinition

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

Class: ezcPersistentObjectDefinition

Main definition of a persistent object. [source]
Each persistent object will have exactly one definition. The purpose of the definition is to provide information about how the database table is structured and how it is mapped to the data object.
For an elaborate example see ezcPersistentSession.

Properties

string read/write  $class
Class-name of the PersistentObject.
array(string=>ezcPersistentObjectProperty) read/write  $columns
The fields of the Persistent Object as an array of ezcPersistentObjectProperty. The key is the name of the original database column.
ezcPersistentObjectIdProperty read/write  $idProperty
Holds the identifier property.
array(string=>ezcPersistentObjectProperty) read/write  $properties
The fields of the Persistent Object as an array of ezcPersistentObjectProperty.
array(string=>ezcPersistentRelation) read/write  $relations
Contains the relations of this object. An array indexed by class names of the related object, assigned to a instance of a class derived from ezcPersistentRelation.
string read/write  $table
Name of the database table to use.

Member Variables

protected array(string=>mixed) $propertyArray = array(
'table' => null,
'class' => null,
'idProperty' => null,
'properties' => null,
'columns' => null,
'relations' => null,
)

Property array.

Method Summary

public ezcPersistentObjectDefinition __construct( [$table = ''], [$class = ''], [$properties = array()], [$relations = array()], [$idProperty = null] )
Constructs a new PersistentObjectDefinition.
public static ezcPersistentObjectDefinition __set_state( $array )
Returns a new instance of this class with the data specified by $array.

Methods

__construct

ezcPersistentObjectDefinition __construct( [string $table = ''], [string $class = ''], [ $properties = array()], [ $relations = array()], [ezcPersistentObjectIdProperty $idProperty = null] )
Constructs a new PersistentObjectDefinition.

Parameters

Name Type Description
$table string The name of the database table to map to.
$class string The name of the PHP class to map to.
$properties array The properties of the class. See $properties
$relations array The relations of the class. See $relations
$idProperty ezcPersistentObjectIdProperty The primary key of the class/table.

__set_state

ezcPersistentObjectDefinition __set_state( $array )
Returns a new instance of this class with the data specified by $array.
$array contains all the data members of this class in the form: array('member_name'=>value).
__set_state makes this class exportable with var_export. var_export() generates code, that calls this method when it is parsed with PHP.

Parameters

Name Type Description
$array array(string=>mixed)  

Last updated: Wed, 28 Nov 2007