The error message mentions "stdClass::find()", which seems to indicate
that it's not using your ArosAcos model at all. I think the main part
of your problem is that in your ArosAcosController, you have:
var $name = 'aros_acos';
when it should be:
var $name = 'ArosAcos';
Cake uses the $name attibute of your controller to determine the
default classname of the model your controller is using (you can
override this with $uses). Since you don't have a model named
"aros_acos" (you have a filename aros_acos.php, but the model name is
"ArosAcos"), it's not loading the model.
When you execute the line:
$this->ArosAcos->recursive = -1;
PHP creates a new generic "empty" object on-the-fly (based on
stdClass), ($this->ArosAcos) with a attribute "recursive" and assigns
-1 to that property. Since stdClass does not have a find() method,
you get the error message on the next line.
Your attempt to define the joining table using the $options['join'] in
the ArosAcos won't work, because Cake isn't looking for $options in
your model attributes (see http://book.cakephp.org/view/1057/Model-Attributes
and http://api13.cakephp.org/class/model for API detail).
As cricket was hinting, under most circumstances, you normally don't
need to "modelize" join tables (in this case "ArosAcos").
Have you considered one of the ACL Plugins currently available? (You
can google "Cake ACL Plugin" -- the one I use is described on
http://bakery.cakephp.org/articles/interlock/2010/03/02/updated-acl-plugin)
ACL can be complicated AND can prevent your code from running (how
much time have I wasted troubleshooting why a new action I added to an
existing controller refused to work, simply because I forgot to add
permissions to my "admin" user?), so using an existing plugin to
facilitate maintenance of you ACL can give you a little more time to
learn Cake, and also provide you an example of how other Cake
programmers "do it". Read up on Plugins (http://book.cakephp.org/view/
1111/Plugins)
Post by thomPost by cricketWhen I did this I didn't bother modelizing ArosAcos. This is from my
SectionsController. Each Group has different rights for each Section.
Well, what exactly I want is I wanna make a simple ACL Management
based on aros_acos table. So, I wanna update permission, just like
drupal's. But It's not as simple as I thought. Or maybe it's just my
mind which made it not.
I am not quiet understand yet with Joining table in cake. So, what do
you suggest then? I am at my confusing-point already.
--
Regards,,,
mastantohttp://www.mastanto.comhttp://thom-sharing.blogspot.com
--
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+unsubscribe-/***@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php