Names are backwards.

Controllers are plural 
class GroupsController extends AppController {

Models are singular
class Group extends AppModel {

K

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of damia...@gmail.com
Sent: Wednesday, February 16, 2011 11:17 PM
To: CakePHP
Subject: Big problem with using Model 1.3

Hi everyone.
I have a big problem. I create model and controller:

class GroupController extends AppController {
    var $name = 'Group';
    var $uses = array('Groups');
    var $components = array('Session', 'Auth');

class Groups extends AppModel {
    var $name = 'Groups';
    var $useTable = 'groups';
    var $primaryKey = 'id_group';

When I use:

 $user = $this->Group->find('all');

I see this error:
Undefined property: GroupController::$Groups [APP/controllers/
group_controller.php, line 30]

Fatal error: Call to a member function find() on a non-object in /home/
public_html/simple/app/controllers/group_controller.php on line 30

I know that I can use
        $this->loadModel('Groups');
        $groups = $this->Groups->find('all');
this work but I need associations in future. I don't know what is
going on. I use 1.3.6.

Sorry for my English.
Thanks for help

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

Reply via email to