xPDOObjectThe base persistent xPDO object class.
This is the basis for the entire xPDO object model, and can also be used by a class generator xPDOGenerator, ultimately allowing custom classes to be user-defined in a web interface and framework-generated at runtime.
Located in /om/xpdoobject.class.php (line 50)
| Class | Description |
|---|---|
xPDOObject_mysql
|
Implements extensions to the base xPDOObject class for MySQL. |
xPDOObject_sqlite
|
Implements extensions to the base xPDOObject class for SQLite. |
xPDOObject_sqlsrv
|
Implements extensions to the base xPDOObject class for sqlsrv. |
xPDOSimpleObject
|
Extend to define a class with a native integer primary key field named id. |
static string
getSelectColumns
(xPDO &$xpdo, string $className, [string $tableAlias = ''], [string $columnPrefix = ''], [array $columns = array ()], [boolean $exclude = false])
static object|null
load
(xPDO &$xpdo, string $className, mixed $criteria, [boolean|integer $cacheFlag = true])
static array
loadCollection
(xPDO &$xpdo, string $className, [mixed $criteria = null], [boolean|integer $cacheFlag = true])
static array
loadCollectionGraph
(xPDO &$xpdo, string $className, string|array $graph, mixed $criteria, boolean|integer $cacheFlag)
static void
_loadCollectionInstance
(xPDO &$xpdo, &$objCollection, string $className, mixed $criteria, $row, $fromCache, [boolean|integer $cacheFlag = true])
void
addValidationRule
(string $field, string $name, string $type, string $rule, [ $parameters = array()])
void
fromArray
(array $fldarray, [string $keyPrefix = ''], [boolean $setPrimaryKeys = false], [boolean $rawValues = false], [boolean $adhocValues = false])
void
fromJSON
(string $jsonSource, [string $keyPrefix = ''], [boolean $setPrimaryKeys = false], [boolean $rawValues = false], [boolean $adhocValues = false])
xPDOObject|null
&getOne
(string $alias, [object $criteria = null], [boolean|integer $cacheFlag = true])
array
toArray
([string $keyPrefix = ''], [boolean $rawValues = false], [boolean $excludeLazy = false])
array
&_getRelatedObjectsByFK
(string $alias, [mixed $criteria = null], [boolean|integer $cacheFlag = true])
string
$container
= null (line 63)
Name of the data source container the object belongs to.
array
$fieldNames
= null (line 73)
Names of the fields in the data table, fully-qualified with a table name.
NOTE: For use in table joins to qualify fields with the same name.
xPDO
$xpdo
= null (line 56)
A convenience reference to the xPDO object.
array
$_aggregates
= array () (line 157)
An array of aggregate foreign key relationships for the class.
string
$_alias
= null (line 91)
An alias for this instance of the class.
boolean
$_cacheFlag
= true (line 212)
Indicates the cacheability of the instance.
string
$_class
= null (line 79)
The actual class name of an instance.
array
$_composites
= array () (line 164)
An array of composite foreign key relationships for the class.
array
$_dirty
= array () (line 129)
An array of field names that have been modified.
array
$_fieldMeta
= array () (line 150)
An array of metadata definitions for each field in the class.
array
$_fields
= array () (line 143)
An array of key-value pairs representing the fields of the instance.
array
$_lazy
= array () (line 136)
An array of field names that have not been loaded from the source.
boolean
$_new
= true (line 206)
Indicates if the instance is transient (and thus new).
array
$_options
= array() (line 218)
A collection of various options that can be used on the instance.
string
$_package
= null (line 85)
The package the class is a part of.
string|array
$_pk
= null (line 98)
The primary key field (or an array of primary key fields) for this object.
string|array
$_pktype
= null (line 108)
The php native type of the primary key field.
NOTE: Will be an array if multiple primary keys are specified for the object.
array
$_relatedObjects
= array () (line 171)
An array of object instances related to this object instance.
string
$_table
= null (line 115)
Name of the actual table representing this class.
string
$_tableMeta
= null (line 122)
An array of meta data for the table.
array
$_validated
= array () (line 192)
An array of field names that have been already validated.
boolean
$_validationLoaded
= false (line 199)
Indicates if the validation map has been loaded.
array
$_validationRules
= array() (line 185)
An array of validation rules for this object instance.
xPDOValidator
$_validator
= null (line 178)
A validator object responsible for this object instance.
static getSelectColumns (line 549)
Get a set of column names from an xPDOObject for use in SQL queries.
static load (line 400)
Load an instance of an xPDOObject or derivative class.
static loadCollection (line 457)
Load a collection of xPDOObject instances.
static loadCollectionGraph (line 511)
Load a collection of xPDOObject instances and a graph of related objects.
static _loadCollectionInstance (line 359)
Responsible for loading an instance into a collection.
static _loadInstance (line 293)
Loads an instance from an associative array.
static _loadRows (line 230)
Responsible for loading a result set from the database.
Constructor __construct (line 596)
Constructor
Do not call the constructor directly; see xPDO::newObject().
All derivatives of xPDOObject must redeclare this method, and must call the parent method explicitly before any additional logic is executed, e.g.
addMany (line 1130)
Adds an object or collection of objects related to this class.
This method adds an object or collection of objects in a one-to- many foreign key relationship with this object to the internal list of related objects. By adding these related objects, you can cascade xPDOObject::save(), xPDOObject::remove(), and other operations based on the type of relationships defined.
addOne (line 1068)
Adds an object related to this instance by a foreign key relationship.
addValidationRule (line 1743)
Add a validation rule to an object field for this instance.
encode (line 1973)
Encodes a string using the specified algorithm.
NOTE: This implementation currently only implements md5. To implement additional algorithms, override this function in your xPDOObject derivative classes.
fromArray (line 1678)
Sets object fields from an associative array of key => value pairs.
fromJSON (line 1954)
Sets the object fields from a JSON object string.
get (line 855)
Get a field value (or a set of values) by the field key(s) or name(s).
Warning: do not use the $format parameter if retrieving multiple values of different types, as the format string will be applied to all types, most likely with unpredicatable results. Optionally, you can supply an associate array of format strings with the field key as the key for the format array.
getFieldName (line 1625)
Gets a field name as represented in the database container.
This gets the name of the field, fully-qualified by either the object table name or a specified alias, and properly quoted.
getFKClass (line 1575)
Get the name of a class related by foreign key to a specified field key.
This is generally used to lookup classes involved in one-to-one relationships with the current object.
getFKDefinition (line 1610)
Get a foreign key definition for a specific classname.
This is generally used to lookup classes in a one-to-many relationship with the current object.
getMany (line 1051)
Gets a collection of objects related by aggregate or composite relations.
getOne (line 1013)
Gets an object related to this instance by a foreign key relationship.
Use this for 1:? (one:zero-or-one) or 1:1 relationships, which you can distinguish by setting the nullability of the field representing the foreign key.
For all 1:* relationships for this instance, see getMany().
getOption (line 655)
Get an option value for this instance.
getPK (line 1545)
Gets the name (or names) of the primary key field(s) for the object.
getPKType (line 1557)
Gets the type of the primary key field for the object.
getPrimaryKey (line 1507)
Gets the value (or values) of the primary key field(s) for the object.
getValidator (line 1783)
Get the xPDOValidator class configured for this instance.
isDirty (line 1998)
Indicates if an object field has been modified (or never saved).
isLazy (line 1865)
Indicates if the object or specified field is lazy.
isNew (line 2035)
Indicates if the instance is new, and has not yet been persisted.
isValidated (line 1847)
Indicates if the object or specified field has been validated.
remove (line 1441)
Remove the persistent instance of an object permanently.
Deletes the persistent object isntance stored in the database when called, including any dependent objects defined by composite foreign key relationships.
removeValidationRules (line 1764)
Remove one or more validation rules from this instance.
save (line 1181)
Persist new or changed objects to the database container.
Inserts or updates the database record representing this object and any new or changed related object records. Both aggregate and composite related objects will be saved as appropriate, before or following the save operation on the controlling instance.
set (line 686)
Set a field value by the field key or name.
setDirty (line 2017)
Add the field to a collection of field keys that have been modified.
This function also clears any validation flag associated with the field.
setOption (line 669)
Set an option value for this instance.
toArray (line 1650)
Copies the object fields and corresponding values to an associative array.
toJSON (line 1934)
Returns a JSON representation of the object.
validate (line 1824)
Validate the field values using an xPDOValidator.
_getAliases (line 2172)
Find aliases for any defined object relations of the specified class.
_getDataType (line 2046)
Gets the database data type for the specified field.
_getPHPType (line 2063)
Gets the php data type for the specified field.
_getRelatedObjectsByFK (line 1886)
Gets related objects by a foreign key and specified criteria.
_initFields (line 1919)
Initializes the field names with the qualified table name.
Once this is called, you can lookup the qualified name by the field name itself in xPDOObject::$fieldNames.
_loadFieldData (line 2080)
Load persistent data from the source for the field(s) indicated.
_loadValidation (line 1805)
Used to load validation from the object map.
_saveRelatedObject (line 1401)
Save a related object with pending changes.
This function is also responsible for setting foreign keys when new related objects are being saved, as well as local keys when the host object is new and needs the foreign key.
_saveRelatedObjects (line 1352)
Searches for any related objects with pending changes to save.
_setRaw (line 2100)
Set a raw value on a field converted to the appropriate type.
Documentation generated on Mon, 27 Dec 2010 11:08:31 -0700 by phpDocumentor 1.4.3