On Sun, Sep 12, 2010 at 10:30 AM, laduree <[email protected]> wrote:
> I posted this at 
> http://www.cakephpforum.net/index.php?showtopic=2269&st=0&#entry7412
> but it seems there's not much movement in the forum and that people
> have not been getting replies for a couple of days. Here it goes my
> concern with CakePHP:
>
> I have just started working with CakePHP and love how it speeds up
> development. The blog tutorial was a piece of cake. However, I am
> having trouble understanding the Acl controlled application tutorial.
> I can't find parentNode() in the documentation, and how it is all
> implemented by CakePHP seems somewhat obscure.

parentNode() is a method that your model must implement. Think of it
in terms of Java interfaces. The idea is that, when Cake's ACL code
calls YourModel::parentNode() it should get back an array with both
the model name and the ID for the object that is the parent of the
present one. Here's an example from one of my apps. Note the format of
the returned array, and the null should be returned where there is no
parent.

public function parentNode()
{
        if (!$this->id) return null;

        $parent_id = $this->field(
                'parent_id',
                array('Section.id' => $this->id)
        );
        
        return $parent_id
                ? array(
                        'model' => 'Section',
                        'foreign_key' => $parent_id
                )
                : null;
}

This is a very general implementation. There may be circumstances
where a little more code is required.

> Other thing I've noticed is that many of the methods have an "options"
> parameter that takes an array, but, how does one know what options are
> available to include in the array? For example, for the AclBehavior
> setup() method in the parameters section it just says:
>
> mixed $config optional array ( )
>
> So, what are the configuration options available to me, where do I
> find them in the docs, how do I know how to use all these great
> functionality????

Yes, the docs are sorely lacking in specifics on $options but some of
them are listed in the API:
http://api.cakephp.org/

Which methods did you have in mind?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to