Hi there,
first question, complex question :D

i have tables in db like this:

+ leagues
| - lid
| - name

+ users
| - uid
| - name

+ groups
| - gid
| - name

+ league_staff
| - lid
| - gid
| - uid

The models:

class League extends AppModel {
    var $name = 'League';
    var $primaryKey = 'lid';
    var $hasAndBelongsToMany = array(
        'Staff' =>
            array(
                'className'              => 'User',
                'joinTable'              => 'league_staff',
                'foreignKey'             => 'lid',
                'associationForeignKey'  => 'lid',
                'with'                   => 'LeagueStaff',
                'unique'                 => true,
                'conditions'             => '',
                'fields'                 => '',
                'order'                  => '',
                'limit'                  => '',
                'offset'                 => '',
                'finderQuery'            => '',
                'deleteQuery'            => '',
                'insertQuery'            => ''
            )
    );
}

class User extends AppModel {
    var $name = 'User';
    var $primaryKey = 'uid';
}

class Group extends AppModel {
    var $name = 'Group';
    var $primaryKey = 'gid';
}

class LeagueStaff extends AppModel {
    var $name = 'LeagueStaff';
    var $primaryKey = 'gid';
    var $useTable = 'league_staff';
    var $hasOne = array(
        'Group' => array(
            'className'              => 'Group',
            'foreignKey'             => 'gid',
        )
    );
}

This is what i got:

[leagues] => Array
                (
                    [0] => Array
                        (
                            [League] => Array
                                (
                                    [lid] => 1
                                    [name] => first league
                                )

                            [Staff] => Array
                                (
                                    [0] => Array
                                        (
                                            [uid] => 1
                                            [name] => luke83
                                            [LeagueStaff] => Array
                                                (
                                                    [lid] => 1
                                                    [uid] => 1
                                                    [gid] => 1
                                                )

                                        )

                                )

                        )
                )


This is what i would like:

[leagues] => Array
                (
                    [0] => Array
                        (
                            [League] => Array
                                (
                                    [lid] => 1
                                    [name] => first league
                                )

                            [Staff] => Array
                                (
                                    [0] => Array
                                        (
                                            [uid] => 1
                                            [name] => luke83
                                            [Group] => Array
                                                (
                                                    [gid] => 1
                                                    [name] => admin
                                                )

                                        )

                                )

                        )
                )

it is like when LeagueStaff is invoked the hasOne attribute is not
considered

Can someone explain me what i do wrong?

Thanks for time :D

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to