Welcome Guest, Not a member yet? Register   Sign In
The Controlller and Model same filename -> wrong ?
#17

[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.


Messages In This Thread
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 03:48 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 04:04 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 04:21 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 06:30 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 06:39 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 06:54 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 07:04 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 07:10 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 07:25 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 08:24 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 04-08-2009, 09:13 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-10-2009, 01:42 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-10-2009, 01:58 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-10-2009, 02:15 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-10-2009, 05:45 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 01:38 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 07:51 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 08:10 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 08:33 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 08:45 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 08:55 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 09:04 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 09:14 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 09:26 AM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 12:28 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 01:19 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-11-2009, 04:47 PM
The Controlller and Model same filename -> wrong ? - by El Forum - 05-12-2009, 10:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB