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).
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
-
$type The type name of the object (either fully qualified or simple, if not ambiguous) $id Either 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) $prefix A 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 |
getPrefix | ( | ) |
getType | ( | ) |
getId | ( | ) |
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 |
Check if a serialized ObjectId has a valid syntax, the type is known and if the number of primary keys match the type.
- Parameters
-
$oid The serialized ObjectId.
- Returns
- Boolean
Definition at line 132 of file ObjectId.php.
|
static |
Parse a serialized object id string into an ObjectId instance.
- Parameters
-
$oid The 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 |
Get a dummy id ("wcmf" + unique 32 character string).
- Returns
- String
Definition at line 219 of file ObjectId.php.
|
static |
Check if a given id is a dummy id.
- Parameters
-
$id The 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.