Nevamind. It works with the first value of $uses.

$this->modelClass = $uses[0];

On Jul 26, 2:21 pm, rtconner <[EMAIL PROTECTED]> wrote:
> Is there any way to change the primary Model of a controller?
>
> Why you ask? I have a good answer for you, I hope.
> First off I was told that overuse of the $uses variable is not a good
> idea. So now that that is established, let us also establish that I
> use paginate a lot. 3-4 times per Controller.
>
> So I am paginating in a controller by several Models which are related
> to a Model which is not the pimary Model of the controller. Right now
> in order for this to work I have to add each model I'm paginating by
> to the $uses array. I looked at the paginate code. If I was able to
> change the primate Model of a Controller ($this->modelClass) to a
> model that I set, then I would be able to use the $uses variable far
> less.
>
> I don't care too much, but I'm thinking if I can do this one thing it
> will reduce memory usage and make things slighty faster. As well as
> being a bit cleaner cake code.
>
> I posted this on IRC before.. I'll just post it again for show.. my
> lovely $uses array.
>
> var $uses = array('Customer', 'CustomersContact', 'CustomersRep',
> 'CustomersAddress', 'CustomersPhoneNumber', 'CustomersComment',
> 'CommentsCategory', 'Vehicle', 'VehiclesYear', 'VehiclesMake',
> 'VehiclesModel', 'VehiclesTrim', 'StoreLocation', 'User',
> 'CustomersStatus');
>
> Thanks
> Rob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to