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