Difference between revisions of "ModelBase API"
Line 4: | Line 4: | ||
==Static methods== |
==Static methods== |
||
− | |||
− | ===loadByID=== |
||
===get=== |
===get=== |
||
Line 14: | Line 12: | ||
===filter=== |
===filter=== |
||
− | <code>mixed |
+ | <code>mixed filter(QueryCondition condition)</code> |
====description==== |
====description==== |
||
Line 33: | Line 31: | ||
If <code>new X()</code> is called, it should leave all fields blank and when save is called, it inserts into the DB rather than updates. |
If <code>new X()</code> is called, it should leave all fields blank and when save is called, it inserts into the DB rather than updates. |
||
− | |||
− | |||
− | ==Common Extensions== |
||
Revision as of 02:44, 20 November 2009
An API that should be common to all model classes. Includes core methods that should be available in all classes, and optional methods that provide a common structure for frequently used extensions.
Contents
Core API
Static methods
get
mixed get(QueryCondition condition)
description
Returns a single object matching the condition. Raises an exception if 0 or more than one object match.
filter
mixed filter(QueryCondition condition)
description
Returns a list of objects matching the condition.
Instance methods
save
Updates the objects data in the database. If the data is new, it should insert a new row with the objects data.
update
Pulls the objects data from the database again and updates the object.
delete
new/__construct
If new X($id)
is called, it should instantiate the object with the information associated with that id.
If new X()
is called, it should leave all fields blank and when save is called, it inserts into the DB rather than updates.