Wednesday, August 28, 2013

Re: Models Associations

A controller may "use" more than one model. (Or none at all.)

public $uses = array('Model1', 'Model2');

However, as you're new to Cake I recommend you don't do that. Once you're comfortable with Cake's conventions you'll understand better when to do that.

Your UsersController would contain methods (actions) for logging in and out, resetting passwords, listing Users for the admin, etc.

Note that once you've set up your associations you can chain the models together:

$data = $this->Test->Questions->find('all', ...);

If you haven't already, go through the blog tutorial. It doesn't include everything you'll need to know but it should give you a better idea of how to create an application with Cake.


On Tue, Aug 27, 2013 at 1:28 PM, Michael Roker <mroker@gmail.com> wrote:
Hi folks, this is my new post. I am new to CakePHP, and to be honest I love it. However, I am definitely confused when it comes to the models/tables and associations. I am now working on a small project which is an online exam application. I've read the models section , in particular the models assocation but still very confused. I have some questions.

For my 'objects' I have Users,Questions,Tests,TestScores. I am confused firstly that I have a UsersController, and a QuestionsController and not sure if I can have multiple models per controller. If this is true, then I can only have one table per Model? Do you guys have any resources on designing databases so I can then reflect that onto CakePHP? Lastly, are there any resources or more information on the model associations?

I hope I didn't violate any policies being a new user and all.

Thanks!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: