Hi all, Hoping someone can help me with this, I'm using stable cake release and trying to use generateList using conditions based on multiple models.
I have a team model:
class Team extends AppModel {
var $name = 'Team';
var $validate = array(
'name' => VALID_NOT_EMPTY,
'leader' => VALID_NUMBER,
);
//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Leader' =>
array('className' => 'User',
'foreignKey' => 'leader',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),
);
var $hasAndBelongsToMany = array(
'Project' =>
array('className' => 'Project',
'joinTable' => 'projects_teams',
'foreignKey' => 'team_id',
'associationForeignKey' =>
'project_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
'User' =>
array('className' => 'User',
'joinTable' => 'teams_users',
'foreignKey' => 'team_id',
'associationForeignKey' =>
'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
);
}
-------------------------
And a user model:
class User extends AppModel {
var $name = 'User';
var $validate = array(
'mmu_id' => VALID_NOT_EMPTY,
'name' => VALID_NOT_EMPTY,
'phone' => VALID_NUMBER,
'email' => VALID_NOT_EMPTY,
);
//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $hasOne = array(
'Project' =>
array('className' => 'Project',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'dependent' => ''
),
);
var $hasMany = array(
'Message' =>
array('className' => 'Message',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
var $hasAndBelongsToMany = array(
'Job' =>
array('className' => 'Job',
'joinTable' => 'jobs_users',
'foreignKey' => 'user_id',
'associationForeignKey' =>
'job_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
'Team' =>
array('className' => 'Team',
'joinTable' => 'teams_users',
'foreignKey' => 'user_id',
'associationForeignKey' =>
'team_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
);
}
-----------------------
and what I want to do is:
$this->set('users', $this->Job->User->generateList(array("Team.id" =>
"1")));
from within the JobsController.
I'm obviously doing something wrong, but I can't for the life of me
figure out what, as always any help would be greatly appreciated!!
TIA,
d.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
