Proper names by Cake conventions: DB table: users_details Model class: UserDetail Model name: UserDetail Model file: user_detail.php Controller class: UsersDetailsController Controller name: UsersDetails Controller class: users_details_controller.php
On Mar 22, 6:24 am, redcat <[email protected]> wrote: > I have a database table called users_details > I have a model file called UserDetail.php with the following lines: > > <?php > class UserDetail extends AppModel { > var $name='UserDetail'; > var $useTable='users_details'; > } > ?> > > I have a controller file called users_details_controller.php with the > following lines: > <?php > class UsersDetailsController extends AppController { > var $name = 'Users_Details'; > function listusers() { > $this->set('users_details', $this->UserDetail->find('all')); > > }} > > ?> > > When I go to /app/user_details/listusers I get the following error: > > Fatal error: Call to a member function find() on a non-object in / > cakephp/app/controllers/users_details_controller.php on line 5 > > Notice (8): Undefined property: UsersDetailsController::$UserDetail > [APP/controllers/users_details_controller.php, line 5] > > Now UserDetail model is there - I have even tried to use the variable > useTable as you can see above.. yet why do I get this error of > UserDetail being a "non-object"??? 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
