A database record model. More...
Public Member Functions | |
| __construct ($table_name, $data=null, $exists=false, $options=array()) | |
| Constructor. | |
| copy () | |
| Copy constructor. | |
| get_table_name () | |
| Get table name. | |
| get_original_values ($field=null) | |
| Get the original field values. | |
| children ($where=array()) | |
| For recursive (tree) objects, get the record's children records. | |
| has_children ($where=array()) | |
| For recursive (tree) objects, find if it has children records. | |
| parent () | |
| For recursive (tree) objects, get the record's parent record. | |
| root () | |
| For recursive (tree) objects, get the record's root node. | |
| many_to_many ($map_table_name) | |
| Returns an array of records linked to the table using a mapping table in a many-to-many relationship. | |
| get_mapping_table ($table_name) | |
| Returns a mapping table if the supplied table is related to this table in a many-to-many relationship. | |
| get_model () | |
| Get the record's model object. | |
| get_model_class () | |
| Get the model's class. | |
| exists () | |
| Has the record been saved? | |
| set_exists ($item) | |
| Set the record's exist property to true (the record has been saved). | |
| set_values ($values) | |
| Set the record's values. | |
| save () | |
| Save the record. | |
| delete () | |
| Delete the record. | |
| is_modified ($field_name) | |
| Check if the record has been modified. | |
| is_field ($field_name) | |
| Does the field exist? | |
| set_field ($field_name, $value=null) | |
| Set the field value. | |
| get_value ($field_name) | |
| Get the field value. | |
| get_id () | |
| Get the record's ID. | |
| one ($table) | |
| Just get one (the first) of a record in a one-to-many or one-to-one relationship with this record. | |
| __get ($property) | |
| Get the record from a related table. | |
| __call ($property, $params) | |
| Get the record from a related table. | |
Public Member Functions inherited from Base | |
| set_parameters ($arguments) | |
| Set variables from an array to member fields requires $this->optional_arguments or $this->required_arguments to have been set by the subclass. | |
Public Attributes | |
| $h2o_safe = true | |
| can be used in h2o | |
Protected Attributes | |
| $_exists | |
| has the record been saved? | |
| $_table_name = '' | |
| table name | |
| $_model_class = '' | |
| model class name | |
| $_original_values = array() | |
| original field values | |
Protected Attributes inherited from Base | |
| $optional_arguments = array() | |
| Array of options that can be set to variables. | |
| $required_arguments = array() | |
| Array of options that need to be set to variables. | |
Private Member Functions | |
| create ($table_name) | |
| Create a new record. | |
A database record model.
| Db_Record::__call | ( | $property, | |
| $params | |||
| ) |
Get the record from a related table.
Usage:
Reimplemented from Base.
| Db_Record::__get | ( | $property | ) |
Get the record from a related table.
Usage:
| Db_Record::get_mapping_table | ( | $table_name | ) |
Returns a mapping table if the supplied table is related to this table in a many-to-many relationship.
| Db_Record::get_model | ( | ) |
Get the record's model object.
The object is stored as a singleton in the $_REQUEST array to save resources.
1.8.1.1