You can. In your example, '$this' refers to the current controller. If the controller is users_controller, you get to its model by $this->User. You can do the same with anything in the uses array, and you can also reach related models by daisy chaining them. So if User hasMany Post hasMany Comment, you can do this:
$this->User->Post->Comment to get to the the Comment model. Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 10 Feb 2011, at 19:45, cake-learner wrote: > Why not we can't access models by > $this -> Controller -> ModelName( I meant all models defined in > $uses ) > or > $this -> Controller -> Uses -> ModelName? > > > -- > 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 > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
