Detailed Description

ObjectId is the unique identifier of an object.

Note
The ObjectId must provide enough information to select the appropriate mapper for the object. This may be achived by different strategies, e.g. coding the object type into the ObjectId or having a global registry which maps ObjectIds to objects. wCMF uses the first method. Serialized ObjectIds have the following notation: prefix:type:id1:id2:... where type is the object type and id1, id2, .. are the values of the primary key columns (in case of simple keys only one). Serialization is done using the __toString method (using the ObjectId instance in a string context).
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 27 of file ObjectId.php.

Public Member Functions

 __construct ($type, $id=null, $prefix=null)
 
 getPrefix ()
 
 getType ()
 
 getId ()
 
 getFirstId ()
 
 __toString ()
 
 containsDummyIds ()
 

Static Public Member Functions

static NULL_OID ()
 
static isValid ($oid)
 
static parse ($oid)
 
static getDummyId ()
 
static isDummyId ($id)
 

Public Attributes

const DELIMITER = ':'
 

Constructor & Destructor Documentation

__construct (   $type,
  $id = null,
  $prefix = null 
)

Constructor.

Parameters
$typeThe type name of the object (either fully qualified or simple, if not ambiguous)
$idEither a single value or an array of values (for compound primary keys) identifying the object between others of the same type. If not given, a dummy id will be assigned (optional, default: null)
$prefixA prefix for identifying a set of objects belonging to one storage in a distributed enviroment
Note
If id is an array, the order of the values must match the order of the primary key names given by PersistenceMapper::getPkNames().

Definition at line 54 of file ObjectId.php.

Member Function Documentation

static NULL_OID ( )
static

Get the NULL instance.

Returns
String

Definition at line 87 of file ObjectId.php.

getPrefix ( )

Get the prefix.

Returns
String

Definition at line 98 of file ObjectId.php.

getType ( )

Get the type (including namespace)

Returns
String

Definition at line 106 of file ObjectId.php.

getId ( )

Get the id.

Returns
Array

Definition at line 114 of file ObjectId.php.

getFirstId ( )

Get the first id.

This is especially usefull, when you know that this id only consists of one id.

Returns
String

Definition at line 122 of file ObjectId.php.

static isValid (   $oid)
static

Check if a serialized ObjectId has a valid syntax, the type is known and if the number of primary keys match the type.

Parameters
$oidThe serialized ObjectId.
Returns
Boolean

Definition at line 132 of file ObjectId.php.

static parse (   $oid)
static

Parse a serialized object id string into an ObjectId instance.

Parameters
$oidThe string
Returns
ObjectId or null, if the id cannot be parsed

Definition at line 144 of file ObjectId.php.

__toString ( )

Get a string representation of the object id.

Returns
String

Definition at line 204 of file ObjectId.php.

static getDummyId ( )
static

Get a dummy id ("wcmf" + unique 32 character string).

Returns
String

Definition at line 219 of file ObjectId.php.

static isDummyId (   $id)
static

Check if a given id is a dummy id.

Parameters
$idThe id to check
Returns
Boolean

Definition at line 228 of file ObjectId.php.

containsDummyIds ( )

Check if this object id contains a dummy id.

Returns
Boolean

Definition at line 236 of file ObjectId.php.

Member Data Documentation

const DELIMITER = ':'

Definition at line 29 of file ObjectId.php.