Conventions for DBC classes
- Always put data modification operations (save, delete) in transaction
- Methods that query database and return object should be named as load_*
- Methods that query database and return array of objects should be named as load_arr_*
- Methods that query database and return simple array should be named as select_*
- Methods that prepare SQL statements for grids (see Chapter 13, Grids) should be called get_sql_for_grid() and get_sql_count_for_grid()
delete() method should be static and to delete just one record- Methods that delete records form multiple tables, i.e. child records should be named as
delete_cascade() - Fatal errors must throw an exception
- Format SQL statements for maximum readability
- Always escape strings when saving and unescape when loading
- DB table names are in plural, DBC classes - in singular form, i.e. users DB table but
User class