I'm currently making an app in CodeIgniter and I was wondering on how I should deal with models. The way I have it set up at the moment:
Views: display Controllers: display related things, form validation, redirects, talk to libraries, etc Libraries: do the heavy lifting, talk to the models, generate error messages, logs, etc Models: talk to the DB
(I'm currently using Active Record for most things)
Let me go straight to an example:
I have an Auth library and inside I have queries that area somewhat similar, varying only by the value in the WHERE clause.
Ex:
get_by_id($id);
get_by_password_hash($email);
get_by_email($email);
Should I have a bunch of these duplicate model functions or should I just have one simple function where I pass WHERE clauses and whatnot via the library?
Ex:
$where = array('id' => $id);
get($where);
Please let me know if you'd like me to clarify anything. Thanks in advance.