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<td>\n\t\t\t" . $html->link(${$singularVar}[$_alias]
[$_details['displayField']], array('controller'=>
$_details['controller'], 'action'=>'view', ${$singularVar}[$_alias]
[$_details['primaryKey']])) . "\n\t\t</td>\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 [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
-~----------~----~----~----~------~----~------~--~---