That's what I was basing on, and the post that I linked where you can see
for example Larry recommending to take out $uses in AppController.

I still believe it is better to make a component when a model is to be used
from AppController. I want AppController to deal with stuff that is general
to all controllers, and when that stuff involves model interaction I prefer
to use components.

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de AD7six
Enviado el: Jueves, 07 de Diciembre de 2006 08:12 a.m.
Para: Cake PHP
Asunto: Re: Model not available from app_controller


On Dec 7, 8:35 am, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> You should not use models from your AppController. If you need model logic
> set it as a component and use the component from AppController.
>
> Check this post:
>
> http://groups-beta.google.com/group/cake-php/browse_thread/thread/179...
> 8b7276/e2767af2ee5ce498?lnk=gst&q=&rnum=21#e2767af2ee5ce498
>

Hi All,

It used to be true that if you declare $uses in your app controller,
you would lose the automatic "This controller has a model of the same
name unless you tell me otherwise" logic in child classes, but this
change means that it isn't true anymore:
https://trac.cakephp.org/changeset/4012/branches/1.1.x.x/cake/libs/controlle
r/controller.php

IIRC another consequence use to be that you could invoke a loop if
anything related to the models in your app controller were not correct
- but if that ever was the case, it certainly isn´t true anymore it
seems.

Irgo it seems that with a recent cake version, declaring $uses in your
app controller doesn´t cause any problems whatsoever.

WRT the OP, it's probably worth bearing this in mind:
If an error is triggered, an instance of the app_controller is used -
but models are not loaded. It would be wise to put if (low($this->name)
!= 'app') {} around the use of this model to allow you to avoid it
being run for (missing connection, missing model) errors.


--~--~---------~--~----~------------~-------~--~----~
 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