I agree that this would be the more "cake" way to do it. Just make a "virtual" model that doesn't relate to any specific table and use that model to run hand-written queries.
To follow up with the points others have made, they are right - you do not need to associate a model 1:1 with a controller. In most of my applications, my controllers are named based on their functionality, and then I bring in a variety of models via $uses. For instance, I generally have an accounts_controller which uses Users, Profiles - I don't have an Accounts model. On Jul 9, 5:33 am, Grzegorz Pawlik <[EMAIL PROTECTED]> wrote: > I'll add my two cents ;) > In Chris's advice (very good btw) maybe You'll need to define > statistic model for statistics_controller, and in class Statistic set > var $useTable = false; > (because controller always expects to have a model) > > On Jul 9, 4:00 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > On Tue, Jul 8, 2008 at 9:53 PM, [EMAIL PROTECTED] > > > <[EMAIL PROTECTED]> wrote: > > > > Hi. > > > > I'm trying to fetch some data from the DB from a statistics controller > > > that doesn't have any particular model associated with it. I just need > > > to collect some info from the DB with some custom queries. > > > Again, you missed my point. You are not limited to models that are > > associated with a specific controller. There's no reason why you > > could not do this: > > > 1) create your model > > 2) tell your controller to use that model via either $uses or app::import > > 3) $results = $this->Model->query(...) > > > I'm hoping I am not misunderstanding the problem. > > > -- > > Chris Hartjes > > Internet Loudmouth > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
