It's slightly broken... I mistyped this...
The isset()s should be negated too... now it's corrected...
var $dontUseModels = Array(
'method1' => true,
'method2' => true,
...
);
function constructClasses() {
if(!isset($this->dontUseModels[$this->action])){
parent::constructClasses();
}
return true;
}
function beforeFilter(){
if(!isset($this->dontUseModels[$this->action])){
parent::beforeFilter();
}
}
On Apr 14, 7:42 am, Aivaras <[email protected]> wrote:
> You define dontUseModels, but you are checking for dontUserModels, are you
> sure this code is working as expected? :)
>
> Cheers,
> Faifas
>
> 2009/4/14 Dérico Filho <[email protected]>
>
>
>
> > I solved.
>
> > I put this in one of application controllers... although it can be put
> > also in app_controller.php
> > var $dontUseModels = Array(
> > 'method1' => true,
> > 'method2' => true,
> > ...
> > );
>
> > function constructClasses() {
> > if(isset($this->dontUserModels[$this->action])){
> > parent::constructClasses();
> > }
> > return true;
> > }
>
> > function beforeFilter(){
> > if(isset($this->dontUserModels[$this->action])){
> > parent::beforeFilter();
> > }
> > }
>
> > On Apr 13, 7:42 pm, Dérico Filho <[email protected]> wrote:
> > > Hi,
>
> > > I am a very particular situation here. I have a controller which 2
> > > methods do not connect into any database, they are as simple as
> > > displaying a view.
>
> > > However, I noticed, every time a open these methods, the CakePHP open
> > > a database connection, which is useless, because, as I told, these do
> > > nothing.
>
> > > What should I do to prevent CakePHP opening this useless database
> > > connection?
>
> > > I thought hacking into controller.php... But is there any cleaner
> > > solution?
>
> > > []s
> > > Dérico Filho
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---