Framework
3.9
|
Abstract base class for all DataItem implementations. More...
Public Member Functions | |
decorate ($name, $value) | |
Adds a decoration to the DataItem. More... | |
getDecoration ($name) | |
Retrieve the value of a decoration on the current DataItem. More... | |
cast ($class) | |
Cast this object to another class. More... | |
setOption ($opt) | |
Set a behavior option flag. More... | |
clearOptions ($opt) | |
Clear the specified behavior option flag. More... | |
getConnection () | |
Retrieves a connection to the database. More... | |
joinTransaction ($tx) | |
Join the DataItem to the specified DataTransaction. More... | |
getTransaction () | |
Retrieves the current DataTransaction. More... | |
getIdentityConstraint () | |
Subclasses can override this function to provide additional identity constraints to be used when querying or updating. More... | |
populate ($line) | |
Populates the object using the supplied associative array (field -> value). More... | |
getFields () | |
Retrieve the field type list for this object. More... | |
getFieldList ($alias="") | |
Returns a comma-separated list of the fields for this object (applying the assigned filter if there is one). More... | |
getFieldArray () | |
Return an array of field names for this object filtered by any active filter. More... | |
hasField ($field) | |
Returns true if this DataItem contains a field with the specified name and that field is not excluded by a filter. More... | |
hasRelation ($relation) | |
Returns true if this DataItem contains a relation with the specified name. More... | |
getPrimaryKey () | |
Retrieves the primary key field name. More... | |
getPrimaryKeyList () | |
Retrieves a list of all the primary keys used for an object as an array. More... | |
get ($field) | |
Retrieve the value for the specified field. More... | |
getPrimaryKeyValue () | |
Retrieves the primary key value. More... | |
set ($field, $value) | |
Set the value of the specified field. More... | |
getType ($field) | |
Retrieves the data type of the specified field. More... | |
getHiddenFields () | |
Retrieves the list of hidden fields. More... | |
getFilter () | |
Returns the filter set on this object. More... | |
setFilter ($filter) | |
Sets the filter on this object. More... | |
getFieldAliases () | |
Retrieve the list of field aliases. More... | |
getFieldAnnotations () | |
Retrieve the list of field annotations. More... | |
load ($id) | |
Load the object with the specified primary key. More... | |
save () | |
Store the object in the database. More... | |
select () | |
Select the object from the database, based on the value of the primary key field. More... | |
exists ($constraint="") | |
Check whether the object exists in the database. More... | |
update () | |
Update the row in the database that corresponds to this object. More... | |
delete ($constraint="") | |
Delete the row in the database that corresponds to this object. More... | |
deleteAll () | |
Delete all the rows in the database that correspond to this class. More... | |
cacheLookup ($id) | |
Populate the object from the local cache if the object is marked as "cacheLocal". More... | |
quoteFieldValue ($field, $type=null) | |
Returns the properly quoted value of the specified field. More... | |
quoteValue ($val, $type) | |
formatFieldValue ($field, $template="") | |
formatFieldForXML ($field) | |
Format field for XML output. More... | |
reformatToSQLDate ($date) | |
Reformats the specified date to be in a format used by the database. More... | |
reformatFromSQLDate ($date) | |
insert () | |
Insert a new row in the database to store this object. More... | |
distinctValues ($field, $sorted=false, $constraint="") | |
Retrieves the distinct values in the database for the specified field across the specified set of records. More... | |
fromGET () | |
Automatically populate the object based on parameters in the $_GET collection. More... | |
fromPOST () | |
Automatically populate the object based on parameters in the $_POST collection. More... | |
fromREQUEST () | |
Automatically populate the object based on parameters in either the $_GET or $_POST collection, depending on the method used to access the page. More... | |
compare ($to) | |
Compare this object to another object. More... | |
copy ($from) | |
Copies values from another object, field by field. More... | |
toXML ($indent=0, $path=null) | |
Generates an XML representation of the object. More... | |
fromXML ($node) | |
Populates the object from the specified XML node. More... | |
fromJSON ($json) | |
Populate from the supplied JSON object. More... | |
format ($template="", $separator=", ") | |
prettifyFieldName ($field) | |
prettifyClassName ($plural=false) | |
relateTo ($target, $field="") | |
Link this object to the specified target by setting corresponding field to the value of the target's primary key. More... | |
Public Attributes | |
$filter | |
$_options = 0 | |
$_tx = null | |
Tracks the current database transaction for each DataItem. More... | |
$_decorations = null | |
Abstract base class for all DataItem implementations.
Definition at line 160 of file abstract_data_item.inc.
AbstractDataItem::cacheLookup | ( | $id | ) |
Populate the object from the local cache if the object is marked as "cacheLocal".
Reimplemented in DataItem.
Definition at line 414 of file abstract_data_item.inc.
|
abstract |
Cast this object to another class.
This facility is provided so that it is possible to cast from a CompositeDataItem to one of its constituents to provide support for polymorphism in those cases.
string | $class |
DataItemException |
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::clearOptions | ( | $opt | ) |
Clear the specified behavior option flag.
integer | $opt | the option to clear |
Definition at line 215 of file abstract_data_item.inc.
|
abstract |
Compare this object to another object.
If all the fields match, the method returns true, otherwise false. If a filter is in place on the source object, then only the filtered fields are compared.
object | $to | the object with which to compare this object |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Copies values from another object, field by field.
If a filter is in place on the source object, then only the filtered fields are copied.
object | from the object from which data is to be copied |
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::decorate | ( | $name, | |
$value | |||
) |
Adds a decoration to the DataItem.
Decorations are not full fields, but can be referred to in format() calls.
string | $name | |
string | $value |
Definition at line 173 of file abstract_data_item.inc.
|
abstract |
Delete the row in the database that corresponds to this object.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Delete all the rows in the database that correspond to this class.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieves the distinct values in the database for the specified field across the specified set of records.
string | $field | |
boolean | $sorted | |
string | $constraint |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Check whether the object exists in the database.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Reimplemented in CompositeDataItem, and DataItem.
AbstractDataItem::formatFieldForXML | ( | $field | ) |
Format field for XML output.
Definition at line 515 of file abstract_data_item.inc.
AbstractDataItem::formatFieldValue | ( | $field, | |
$template = "" |
|||
) |
Definition at line 492 of file abstract_data_item.inc.
|
abstract |
Automatically populate the object based on parameters in the $_GET collection.
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::fromJSON | ( | $json | ) |
Populate from the supplied JSON object.
mixed | $json | either a decoded JSON object, or the string representation |
Definition at line 657 of file abstract_data_item.inc.
|
abstract |
Automatically populate the object based on parameters in the $_POST collection.
If the key does not exist in $_POST and the type is Boolean, that means that the user unchecked a checkbox and we need to assign 0 to the field.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Automatically populate the object based on parameters in either the $_GET or $_POST collection, depending on the method used to access the page.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Populates the object from the specified XML node.
DOMNode | $node |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieve the value for the specified field.
string | $field | the field to retrieve |
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::getConnection | ( | ) |
Retrieves a connection to the database.
Definition at line 225 of file abstract_data_item.inc.
AbstractDataItem::getDecoration | ( | $name | ) |
Retrieve the value of a decoration on the current DataItem.
string | $name | the name of the decoration to retrieve |
Definition at line 187 of file abstract_data_item.inc.
|
abstract |
Retrieve the list of field aliases.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieve the list of field annotations.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Return an array of field names for this object filtered by any active filter.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Returns a comma-separated list of the fields for this object (applying the assigned filter if there is one).
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieve the field type list for this object.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Returns the filter set on this object.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieves the list of hidden fields.
These will be automatically hidden in any AutoForm.
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::getIdentityConstraint | ( | ) |
Subclasses can override this function to provide additional identity constraints to be used when querying or updating.
This allows for easy and safe siloing of data between application users based on session variables.
Definition at line 255 of file abstract_data_item.inc.
|
abstract |
Retrieves the primary key field name.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieves a list of all the primary keys used for an object as an array.
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::getPrimaryKeyValue | ( | ) |
|
abstract |
Retrieves the current DataTransaction.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Retrieves the data type of the specified field.
$field | the field in question |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Returns true if this DataItem contains a field with the specified name and that field is not excluded by a filter.
string | $field |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Returns true if this DataItem contains a relation with the specified name.
string | $relation |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Insert a new row in the database to store this object.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Join the DataItem to the specified DataTransaction.
DataTransaction | $tx | the transaction to join |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Load the object with the specified primary key.
int | id the primary key value to instantiate from |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Populates the object using the supplied associative array (field -> value).
Only values that match the definition of the sub-classed object will be copied. Fields that have been excluded by the use of an InclusionFilter or ExclusionFilter will also not be populated.
array | $line | the array of values to populate the object with. |
Reimplemented in CompositeDataItem.
AbstractDataItem::prettifyClassName | ( | $plural = false | ) |
Reimplemented in CompositeDataItem.
Definition at line 682 of file abstract_data_item.inc.
|
abstract |
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::quoteFieldValue | ( | $field, | |
$type = null |
|||
) |
Returns the properly quoted value of the specified field.
Quoting rules are dependent on the specified type of the field.
string | $field | the field to return |
string | $type | the type of the field. |
Definition at line 426 of file abstract_data_item.inc.
AbstractDataItem::quoteValue | ( | $val, | |
$type | |||
) |
Definition at line 435 of file abstract_data_item.inc.
AbstractDataItem::reformatFromSQLDate | ( | $date | ) |
Definition at line 572 of file abstract_data_item.inc.
AbstractDataItem::reformatToSQLDate | ( | $date | ) |
Reformats the specified date to be in a format used by the database.
string | $date | the date to reformat. |
Definition at line 556 of file abstract_data_item.inc.
|
abstract |
Link this object to the specified target by setting corresponding field to the value of the target's primary key.
DataItem | $target | the DataItem to which the relationship will be created |
string | $field | the field to set for the relationship. If not specified, the primary key of the target object is used for the foreign key field name. |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Store the object in the database.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Select the object from the database, based on the value of the primary key field.
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Set the value of the specified field.
$field | the field to set |
$value | the value to which the field is to be set |
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Sets the filter on this object.
$filter | the filter |
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::setOption | ( | $opt | ) |
Set a behavior option flag.
integer | $opt | the option to set |
Definition at line 206 of file abstract_data_item.inc.
|
abstract |
Generates an XML representation of the object.
Filters are honored when determining which fields are included in the XML. Empty fields are not output (note that a string field with value "" is not considered empty).
Reimplemented in DataItem, and CompositeDataItem.
|
abstract |
Update the row in the database that corresponds to this object.
Reimplemented in DataItem, and CompositeDataItem.
AbstractDataItem::$_decorations = null |
Definition at line 166 of file abstract_data_item.inc.
AbstractDataItem::$_options = 0 |
Definition at line 163 of file abstract_data_item.inc.
AbstractDataItem::$_tx = null |
Tracks the current database transaction for each DataItem.
Definition at line 164 of file abstract_data_item.inc.
AbstractDataItem::$filter |
Definition at line 162 of file abstract_data_item.inc.