Here's my issue, and my tables:
**sales_person**
id | sp_number | name
31 | 23948223 | John Doe
**Team**
id | name | parent_id | lft | rght
52 | Super Team | 1 | 1 | 2
**Team_Salesmen**
id | team_id | sales_person_id
1 | 52 | 31
So I have my sales people, my teams, and a table to show which salespeople belong to which teams.
I was going to display a list of all of a team's children teams, then list all of their salespeople.
Teams is related to Team_salesmen by the team_id, so I can do a contain on that. The trouble is, this only returns the Team_salesmen entity 'id:1, team_id:52, sales_person_id:31', whereas I need it to return the name and number of the salesman.
So, while in the Teams model I need to contain with TeamSalesmen and then contain from TeamSalesmen to SalesPerson. How can I chain commands? CakePHP thinks I'm trying to contain Teams to SalesPersons, which aren't related directly.