I'm developing a site like "yellow pages" with more complex DB than I had ever experienced before.
For example: This DB has 3 tables: 1. organisations – with some general information. 2. services - with list of all services that can be provided. 3. relation table.
Organisations table structure:
id name city phone etc.
1 CompanyName Farewell 987-65-43
Services table structure:
id ServiceType
1 purchase
-----
2 sale
-----
3 exchange
etc.. you get the point
And relation table structure:
id OrganisationID ServId
1 1 2
----
2 1 3
----
3 1 6
----
4 2 3
In website output I need a list of all organisations with all the services they provide.
I can't fully understand (even after reading Linking Models Together section in the CookBook) how I should combine all this tables using Cake's syntax and conventions.
I'll be glad if anyone can provide me a Cake's model/model's (how many I need?) example with ability to retrieve this data.