might some more answers closer to the source. I'm currently mucking
about with CakePHP, deciding if I'll use it in an upcoming web
application.
The problem is, I've got several tables which at some point share
relevant data with each other. If I were to write all the code myself
I would use an SQL query using rather a lot of different joins and
subqueries. But from what I understand CakePHP only supports joins
between two tables.
So for example, I have Users, Profile, Rank, Rating tables and I want
to get the profile, rank and ratings of one particular user. CakePHP
will do the trick by using multiple, separate SELECT statements. But
this would be possible using one query with multiple joins.
Performance is expected to be quite important, so not being too
wasteful with SQL queries is a major perquisite.
I've found two hacks (<a href="http://lloydhome.com/blog/development/
2009/recursive-association-support-cakephp-12">one behaviour</a> and
<a href="http://mark-story.com/posts/view/using-bindmodel-to-get-to-
deep-relations">one using bindModel</a>) and <a href="http://
stackoverflow.com/questions/806650/in-cakephp-how-to-retrieve-joined-
result-from-multiple-tables">a StackOverflow thread</a>.
I'm undecided whether to use the behaviour or the bindModel hack.
Could anybody shed any light as to what is the best approach - viz.
what integrates best in the overall CakePHP structure (are features
like pagination still available)? Or is there another approach which
is ultimately better. The aformentioned SO thread mentions a method
using containables.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment