Cake 1.2 Beta / Php 5.xx / Firebird 2
I have never succeeded in making even the simplest HABTM association
work. I tried scaffold and reading everything I could and
experimenting different ways. Here is the simple setup:
Users: id, name
Groups: id, name
Groups_Users: user_id, group_id
Model: User.php
class User extends AppModel {
var $name = 'User';
var $useTable = 'users';
var $hasAndBelongsToMany = array(
'Group' => array('className' => 'Group',
'joinTable' => 'groups_users',
'foreignKey' => 'group_id',
'associationForeignKey' => 'user_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
}
When I use 'find' in my user controller and then dump the array, I
get the [user] array data, but [group] array is always empty.
The debug message shows the SQL from two queries. When I run the
queries manually they each return data (from users and groups
respectively) as expected.
I know it should be simple, but why can't I get the [group] array
populated from the queries. It has been driving me mad!
Regards, villas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---