Re: Newbie: Moving away from the tutorial apps and encountered first issue
[resolved] A night of sleep gave me a fresh pair of eyes that alerted me to where the problem was and I quickly worked out that I was not requesting the id field when specifying fields to be fetched during model association. Thought they came through by default, but I was wrong, they have to be included too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Newbie: Moving away from the tutorial apps and encountered first issue
More info for someone, could still do with some help though. After a nights rest I was more capable of reading the notice properly and debug where the problem was occurring. It seems that my user model is failing to read the primary key of the user_group model. When accessed by the following line: echo "\t\t\n\t\t\t" . $html->link(${$singularVar}[$_alias] [$_details['displayField']], array('controller'=> $_details['controller'], 'action'=>'view', ${$singularVar}[$_alias] [$_details['primaryKey']])) . "\n\t\t\n"; I believe the main culprit to be the "${$singularVar}[$_alias] [$_details['primaryKey']]" part. I get the same issue when viewing a user and it tries to echo out a link to view the user_group. I believe I have followed the naming conventions correctly, can someone have a quick look over the following: - models are named 'user.php' and 'user_group.php' - db tables are named 'users' and 'user_groups' and both have an id field, set as the primary key with auto_increment enabled - the 'users' table has a 'user_group_id' field which as you can see below is specified as the belongsTo/hasMany foreign key user.php starts: class User extends AppModel { var $name = 'User'; var $belongsTo = array( 'UserGroup' => array('className' => 'UserGroup', 'foreignKey' => 'user_group_id', 'fields' => array('name'), 'counterCache' => true ) ); ... } user_group.php starts: class UserGroup extends AppModel { var $name = 'UserGroup'; var $hasMany = array( 'User' => array('className' => 'User', 'foreignKey' => 'user_group_id', 'dependent' => false ) ... ); Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Newbie: Moving away from the tutorial apps and encountered first issue
Hi all, I have spent the last 3 days reading book.cakephp.org for 1.2, although I must admit to starting to skim through chapters from section 6 onwards (it's always there for reference). I worked through the Blog and Acl Controlled App tutorials and whilst I had a few problems with the second I pretty much though I knew what had caused them. After 3 days of reading and dabbling it was time to throw myself into a self-created project. I spent some time creating my Db Schema, spent a lot of time creating my Models and then baked myself some scaffolded controllers and views, without admin routing. I then applied the first few steps of the Acl Controlled App Tutorial to get myself setup with ACOs and AROs and have gotten to the point where I have created two User Groups and my first User. After creating my first user and being returned to /users/index I am getting the following notice above my user list: Notice (8): Undefined index: id [CORE/cake/libs/view/scaffolds/ index.ctp, line 56] I'm sure this is something simple, but for the wealth of debug info I have available I can't work out which id it is telling me has not been defined. You can view this for yourself at http://ellienevegardner.me.uk/cake_1_2/users. There is definitely an index defined on the users/user_groups tables and the associated foreign id's are all correct as far as I can tell. Regards, Paul. Note: I have configured FirePHP, not sure how this impacts on people accessing the page without FireFox/FirePHP installed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---