|CakePHP Official Site · Rules and Regulations||Help Search Members Calendar Shoutbox|
|Welcome Guest ( Log In | Register )||Resend Validation Email|
Posted: Aug 8 2011, 06:43 PM
Member No.: 3094
Joined: 8-August 11
So I'm new to Cake PHP, sorry if this is a dumb question but I couldn't find answer with a search.
I am making a site with a HABTM association between products an categories. The categories are displayed in navigation with every page, but there may be many thousands of products. The books says:
"Once this association has been defined, find operations on the Recipe model will also fetch related Tag records if they exist"
Which for me means a query on categories for the navigation bar would result in every product in the database being fetched with every page view, very hard on the server as inventory grows. My question is, what's the best way to deal with this? I know how to do it directly with SQL, but I am trying to learn the Cake practices.
Posted: Aug 10 2011, 02:30 PM
Member No.: 2175
Joined: 19-July 10
Look at recursive
and containable behaviour
DE-bug.org ~ a simple bug tracking system