[eluser]zoran119[/eluser]
[quote author="johnpeace" date="1283883461"]'application' is a bit broad...what does your model 'application' represent? Would it be better broken down into smaller pieces?[/quote]
'application' is probably ok... think of it as a membership application for a club of some kind.
yeah, i was thinking that the model should represent an entity in my application, rather than being just a 'container' for a whole heap of functions that deal with applications. in my current setup every function takes an application_id (rather than using to $this->application_id) and does whatever it needs to do in the database, which kind of makes the whole object oriented part of mvc useless.
so, in a world more similar to what you have described (model has properties that are the same as the table describing the entity) how would you deal with a query like 'update all applications submitted by bob to approved'. what's a nice way of getting all bob's applications?
i get a bit confused here... i can think of a couple of ways of doing it:
1. having another class called application_set with a private array which contains all the application instances (initialised by an sql statement for example)? and then a function set_status($new_status_id) which would iterate all the object instances and call their set_status method... this seems inefficient... too many database updates.
2. do the same as in 1, but forget the whole idea of a new application_set model/class and just do it all in the controller... but i shouldn't run sql in the controller... where do i put this function to retrieve multiple (bob's) applications?
3. just update it all the poor man's way with sql (update application set status_id = 1 where owner = 'bob')... but then this is not 'clean' and where do i put this sql anyway... doesn't belong in the controller or the application model...
not sure of what the best way would be (probably none of those). any suggestions?