F-it data controller
From Deep Thought
FrameIT database control modules.
Contents |
[edit]
wij_model
[edit]
Methods, Public
- attach (&observer)
- attribute_changed(notice)
- belongs_to(attribute,options)
- column_changed(notice)
- create_attribute(attribute,options)
- get(attribute)
- has_one(attribute,options)
- initialize(attributes)
- notify(notice)
- parse_options(options)
- post_notice($notice)
- primary_key()
- rollback_needed()
- save($in_transaction = FALSE, $originator_id = -1)
- save_columns()
- save_needed()
- set($attribute, $new_value)
- table()
[edit]
wij_model_factory
Singleton class to create wij_model instances. Call wij_object_factory::instance() if an object of this class is needed.
[edit]
Parameters
[edit]
Where
An array that holds the attributes needed to locate a data object.
Required attributes:
- table = the name of the table this object represents
- sortby = the sort order (ORDER BY) on a data selection
- condition = the filter (WHERE) on a data selection
[edit]
Methods, Public
- clean_up
- instance
[edit]
create($class, $attributes = NULL)
Creates new wij_object.
Class method -- call with scope operator (::).
The following example assumes controller that captures a form post to save form entries to brands table:
// Define our brands class
//
class brands extends wij_model {
function brands($attributes, $db_connection) {
$this->wij_model($attributes, $db_connection);
}
}
// Create the DB connection to the brands table
// First param = the name of the new class we just created
//
$brand = wij_model_factory::create('brands',$_REQUEST);
// Save the fields in the form post into the same-named fields in the DB
//
$brand->save();
[edit]
find($where)
Finds wij_object in database.
Class method -- call with scope operator (::).
[edit]
find_all($where)
Finds all wij_objects in database.
Class method -- call with scope operator (::).
$brand = wij_model_factory::create('brands',$_REQUEST);
$brands_in_db = wij_model_factory::find_all(array('table' => 'brands','sortby' => 'brand_name'));
$this->set_attributes(array('brands'=>$brands_in_db));
echo $this->get_template();
[edit]
wij_abstract_database
[edit]
Methods, Public
- begin
- close_connection
- column_names
- commit
- connection
- current_date_time
- delete(where,[options])
- delete_all(where,[options])
- delete_first(where,[options])
- find(where,[options])
- find_first(where,[options])
- insert(where)
- last_auto_id
- primary_key(table)
- query(sql)
- rollback
- rows_inserted
- save(where,[options])
- update(where,[options])
[edit]
Methods, Protected
- connection_pair(name,value,[separator])
- comma_separated_list(hash,key,[quote])
- escape_values(where)
- generate_delete(where,[options])
- generate_insert(where)
- generate_select(where,[options])
- generate_update(where,[options])
- parse_options(options)
- parse_option(options,key,clause)
[edit]
Properties
[edit]
where
- table
- columns
- condition
- values
[edit]

