Sunday, February 27, 2011

Re: loadModel() and App::import('Model', 'ModelName')

On Feb 27, 2011, at 13:18, iainjames wrote:

> Hey guys, I'm having some trouble telling my controller actions which
> model to use. My controller is structed like so:
> ==================================
> class AdminController extends AppController {
> var $name = 'Admin';
> var $uses = array('News', 'User');
>
> function action_that_uses_news_model() {
> }
>
> function action_that_uses_user_model() {
> }
> ==================================
>
> I'd like to ask how is it that I tell action_that_uses_user_model() to
> use the User model and not the News model.

Don't you just use $this->News->find() in the one action and $this->User->find() in the other one?

--
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@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: