All of ThinkUp’s database interactions are encapsulated in DAO’s (Data Access Objects), contained in the model (the model directory).
What all DAO methods should return:
As seen above multiple SELECT formats does exist:
getData* Data Parsing Methods used internally in DAO, do not use this namespace for data accessing.
get* (e.g. getUsersByID) SELECT queries – It is encouraged that you try to use the noun in Singular or Plural according to single or multi-row return.
set* (e.g. setActive) UPDATE Queries
add* (e.g. addUser) INSERT Queries – It is encouraged that you try to use the noun in Singular or Plural according to single or multi-row insert.
delete* (e.g. deleteUser) DELETE queries
is* (e.g. isActive) IF check returns boolean, i.e.,
if ($user_dao->isUserActive($id)) or
count* (e.g. countUsers) Returns integer with the item count.
insert – takes an object as argument, and inserts it to the table.
save – takes an object as an argument, and stores the data in it back to data backend
poke – Takes an ID as argument, “pokes” the record (sets “last seen” or whatever to now), returns update count (usually 1)
As the storage Backend may or may not be a “database”, it would be encouraged not to create methods with names that imply that the backend is using a database.
However at this time this is not enforced.
When you create a class to contain return data, make sure to make the construct so it can handle no-data-input.
Some return methods slipstreams the data directly into the properties, but the construct is still called with no arguments.
For classes that expect arbitrary (no-standard) data, try overloading