[eluser]drewbee[/eluser]
[quote author="sl3dg3hamm3r" date="1242045489"][quote author="drewbee" date="1239221619"]This method will take one parameter that is an array filling out the $where clause, so when I call it:
$where = array('account_id' => 32);
$this->users_model->get_users($where);[/quote]
drewbee, I think that isn't any good approach to call your model-function like that. You deal with knowledge about your table-format outside of your model. I would definitely pass only the Id, and build the where-statement within your model. Knowledge about the data-format belongs IMHO into the model, only.
I see that your way may keeps the signature of your function-call very flexible, but overpowered flexibility might also lead to unwanted problems, which might become difficult to debug.[/quote]
Yeah, I debated on ways to do this. This is the one and only time I will ever say this, but this is one of the times that I wish functions could work in the way they work within cold fusion.
I would hate to create two functions ie get_users_by_id() or, get_users_by_email() etc etc., and a huge list of parameters is just something that I do not want to manage. I would then need one parameter for every column in the table.