CakePHP Personal Notes

Just links and things as I learn my way around CakePHP

https://github.com/mcurry/cakephp_static_user – didn’t work

Realised that the acl plugin should be in app/Plugin not /plugins
http://book.cakephp.org/2.0/en/plugins.html

Get data from another controller.
http://stackoverflow.com/questions/9205540/cakephp-how-to-retrieve-data-from-another-model-in-controller

$this->Result->Quiz->Question->find('count')

This found all the questions – not, as I first thought, the questions for that quiz.

http://devblog.springest.com/how-to-find-related-data-in-habtm-models/
Helped me to

    public function number_of_questions()
    {
        $x = $this->Question->Quiz->find('all',array(
            'conditions' => array(
                'Quiz.id' => $this->id
            )));
        return(count($x[0]['Question']));        
    }

Not sure what the 0 should be.  Not very “CakePHP ish”. Then

$this->Quiz->number_of_questions()

Uploads:
https://github.com/blueimp/jQuery-File-Upload