If you write into Configure in AppController::beforeFiler() it happens
after models creation in most cases (at least prior Cake 2.0). So you
better create some init function in model for this and call it
manually after Configure set. In init function re-attach behavior with
new params because changes to $this->actsAs won't have effect after
model creation.

On 9 сен, 16:45, badben <ba.dav...@gmail.com> wrote:
> Thanks.
>
> I have tried this and I still get the same issue unfortunately.  any
> ideas of where to start looking if it is a problem with my setup?
>
> On Sep 9, 10:23 am, Thomas Ploch <profipl...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > Hi, since you are setting Model::actsAs before the parent Model is
> > initialized this is doomed to fail.
>
> > Try the following:
>
> > function __construct($id = false, $table = null, $ds = null) {
> >          parent::__construct($id, $table, $ds);
> >          $this->actsAs['Revision']['limit'] 
> > =Configure::read('Setting.System.revision_limit');
>
> > }
>
> > Kind regards
> > Thomas
>
> > Am 09.09.2011 09:47, schrieb badben:
>
> > > I am building a new application in cakephp 2.0 and am struggling using
> > > the configure function.
>
> > > I have a function in AppModel beforeFilter that load the settings from
> > > db into Configure using configure::write.  I also have the following
> > > in my User Model:
>
> > >      function __construct($id = false, $table = null, $ds = null) {
> > >          $test =
> > > (integer)Configure::read('Setting.System.revision_limit');
>
> > >          $this->actsAs['Revision']['limit'] = $test;
> > >          echo Configure::read('Setting.System.revision_limit');
> > >          parent::__construct($id = false, $table = null, $ds = null);
> > >      }
>
> > > The problem is that $this->actsAs['Revision']['limit'] is set to null
> > > even though when I echo
> > > Configure::read('Setting.System.revision_limit'); it returns 20.
>
> > > However, if I change the __construct function to:
>
> > >      function __construct($id = false, $table = null, $ds = null) {
> > >          $test = 20;
>
> > >          $this->actsAs['Revision']['limit'] = $test;
> > >          //echo Configure::read('Setting.System.revision_limit');
> > >          parent::__construct($id = false, $table = null, $ds = null);
> > >      }
>
> > > it seems to work but of course this will not help me.
>
> > > Does anybody know where I have gone wrong?
>
> > > Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to