The models are available in the controller..

$results = $this->ModelName-
>someFunctionYouWroteToGetSomDataBackFromTheDb();


unfortunately cake returns an array of results instead of an object..
so there no doing something like..
$results->sortBy('date ASC');

On Jan 7, 7:38 am, Deane <[EMAIL PROTECTED]> wrote:
> A couple days ago, I lamented that Find* didn't return an array of
> model objects.  I posted about it here, and I was told that one of the
> reasons for this was that it would be "too tempting" to start
> inserting business logic in the views if you had objects available
> there.
>
> Fine.  I'll concede that point for now.
>
> But what about the controllers?  Shouldn't I be able to use models in
> the controllers?  If I do a Find* in a controller to retrieve some
> data (that I have no intention of sending to the view) , shouldn't I
> get model objects back and be able to use methods on those objects?
>
> Controllers are where the business logic *should* live, so there
> doesn't seem to be much argument against using model objects there.
> Yet I still have nothing but these big arrays to deal with.
>
> How does everyone else manage this?  Say you *need* to run some method
> on a model object in one of your controllers.  What is the accepted
> way of doing this?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to