On Saturday, 12 January 2013 23:23:31 UTC+1, Stefano Campanella wrote:
>
> Hi all,
> I am trying to find a way to successfully load a model in before Filter
> without causing the explosion of my controller :D
> I am working on CakePHP 2.3.0 RC2
>
> Basically, I am calling ClassRegistry::init() to load a model in
> AppController's beforeFilter() and it works perfectly. The only problem is
> that after this my controller fails to load its own model, it loads a
> generic AppModel instead.
> In particular, I have my UsersController which executes the beforeFilter()
> of AppController, in which ClassRegistry::init('Group') is called.
> Then if any of my actions try to use $this->User they get an AppModel
> object. If I comment out the ClassRegistry call, $this->User is correctly
> loaded as User object.
>
> Is there a specific way to load a model in beforeFilter() or maybe there
> is a bug in the framework?
>
are you using plugins?
Using ClassRegistry::init in a controller isn't a normal thing to do - and
neither is loading models like that in your beforeFilter (just put the
model in your uses array) - what is it you're doing?
AD
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.