|
At this stage, I'm a beginner myself and so as I learn these really trivial little issues in getting my CakePHP working the way I want to, perhaps you can learn from my mistakes.
|
|
CakePHP -
Basics
|
|
Written by Stuart Duncan
|
|
Friday, 12 February 2010 10:46 |
|
If you've done enough projects, chances are you've had some pretty big table join queries getting a wide range of data from various tables all one time. For the most part, this has never been a problem and shouldn't be a problem still... if you keep one thing in mind; order matters!
It happened to me and so I hit google, the #cakephp chat room, text books and more and found no real concrete answers but I also discovered that a lot of people are experiencing this issue after upgrading MySQL to version 5.
The issue arrises due to CakePHP's auto joining tables using the Model relations that you specify in the model files being joined after you add your own joins to the query you wish to run. That means that if you make a query, include 2 table joins in the query, it'll join those tables and THEN go to the model and find any relations to also join. This may result in a join trying to access a column's information before the column's table has been joined and thus, throwing an error.
There are a couple of ways to avoid this...
|
|
|
CakePHP -
Basics
|
|
Written by Stuart Duncan
|
|
Wednesday, 03 February 2010 13:34 |
|
I spent many hours searching and asking in chat rooms and Cakephp's site and just banging my head against the desk on this one... how in the world do you limit a pagination queries results to x number per page and y number in total??
I wanted to display the top 1000 results out of 1850 or so that I had in the database and show 20 per page.
It seems like a pretty simple problem on the surface but if you try it, you'll see how frustrating it can be. As I said, no one had an answer!!
It wasn't until I stopped, sat down and had some lunch that it dawned on me... the simple problem, had a simple solution!
|
|
CakePHP -
Basics
|
|
Written by Stuart Duncan
|
|
Saturday, 30 January 2010 18:46 |
|
Lately I've been needing to create queries using the "HAVING" expression so that I could find pictures that have received 5 or more votes towards their rating... there are various ways to do that but I really needed to have it use the "HAVING" expression, so I hit the information super highway in search of CakePHP articles and not surprisingly, there were not very many off ramps.
I have a working solution now but it's sort of a hack/fix since CakePHP apparently feels that it's not an expression worth including into their vast number of array options. Here's how I did it:
|
|
CakePHP -
Basics
|
|
Written by Stuart Duncan
|
|
Monday, 18 January 2010 13:35 |
|
Quite often I find articles that I don't really need, but I know that I will need at some point in the future so I add them as a bookmark. So now I've decided to begin adding them to this article... an ever growing list of links and information that I (and hopefully you) will find usefull not and in the future.
|
|
CakePHP -
Basics
|
|
Written by Stuart Duncan
|
|
Friday, 04 December 2009 15:56 |
|
Shortly after figuring out how to do joins in the paginate property, I ran into my next problem.... grouping the results caused paginate to report the wrong number of pages! It turns out that the only place that reports this, as well as having a fix for it, is CakePHP's own bug tracking!!
|
|
|
|
|
<< Start < Prev 1 2 Next > End >>
|
|
Page 1 of 2 |