Recent Posts
- (10/14) Forcing A Single Join in CakePHP PaginationTAGS:CakephpCakephp 13DatabaseErrorsHabtmMysqlMssqlWeb ProgrammingUsage
- (08/11) Inserting NOW() into MySQL Using CakePHPTAGS:CakephpDatabaseMysqlMssqlWeb ProgrammingUsage
- (08/07) Best PaginateCount for CakePHP - with Group By SupportTAGS:CakephpBehaviorsWeb ProgrammingUsageDatabaseExampleMysqlHabtmHack
- (04/03) CakePHP Error Messages Not Showing on FormTAGS:CakephpCakephp 13Web ProgrammingErrorsUsage
- (02/06) Sorting Paginated Results Using a Related Model Field in CakePHPTAGS:CakephpWeb ProgrammingUsageExample
- (11/02) Changing CakePHP's Model useTable on the FlyTAGS:CakephpWeb ProgrammingMysqlDatabaseExampleTutorial
- (10/18) The Funniest Error Message Ever - Thank You EclipseTAGS:EclipseWeb ProgrammingErrorsHumorWindowsUsageSoftwarePhpCakephp
- (09/27) Upgrading CakePHP Application to 1.3 (from 1.2)TAGS:CakephpUpgrade
Subscribe to my feed
Welcome to MainelyDesign.com
A blog mostly about web design
This is the personal blog of Kevin Wentworth. Topics covered here are web programming, design and internet marketing.
Forcing A Single Join in CakePHP Pagination
Posted on 10/14/2011 at 09:25 am | Viewed 750 times | 5 comments
The devil's in the details... I was trying to make a really simple, dreadfully easy, database join in my CakePHP web application. I've forced joins in Cake before, using the 'joins' key in the options array for find calls and paginate calls with no issue. It was late and for the first time I only wanted to use a single join. I copied the join code from a much more complex web app and pasted it into my new 'joins' conditions. And then... I got SQL errors.
Read: Forcing A Single Join in CakePHP Pagination | View: Comments
Inserting NOW() into MySQL Using CakePHP
Posted on 08/11/2011 at 11:16 pm | Viewed 702 times | 0 comments
Great find. If you want to insert NOW() into your query using CakePHP's save() or saveAll() functions, you can use the following expression:
Read: Inserting NOW() into MySQL Using CakePHP | View: Comments
Best PaginateCount for CakePHP - with Group By Support
Posted on 08/07/2011 at 05:03 pm | Viewed 870 times | 0 comments
I'm been muddling my way through pagination with multiple joins, and complex filtering. I finally got it all working (more on that later, maybe....) when I noticed that I couldn't paginate my results. Everything was working fine until I added a "group" parameter to the find call. Instead of getting the right count, I got a count of 1! A quick look at my sql log tables (at the bottom of the page) and I saw that I had actually returned all the mysql records that were needed! If only there was a way to use them...
Read: Best PaginateCount for CakePHP - with Group By Support | View: Comments
CakePHP Error Messages Not Showing on Form
Posted on 04/03/2011 at 12:40 pm | Viewed 2,199 times | 2 comments
I ran into an issue today that I've run into before, except I couldn't remember what I did to fix it (hence this article). I was using CakePHP validation rules to validate a user account details. The CakePHP validation was properly failing (the form data wasn't being saved) and I could tell the validate array was set correctly because the required fields were having the class .required added to them. The only problem? No error messages were being output to the form. The form validation would fail, but the CakePHP error messages were not being shown.
Read: CakePHP Error Messages Not Showing on Form | View: Comments
Sorting Paginated Results Using a Related Model Field in CakePHP
Posted on 02/06/2011 at 10:12 pm | Viewed 2,466 times | 0 comments
Time crunch, so this will be quick. I didn't want to go hunting for how to sort paginated results in CakePHP using a related model field again. I actually found my answer on Stack Overflow. The original poster had it right, so I'm not sure if it was a CakePHP bug or what (I don't have an account or I would correct it... it's on the list of to-dos though).
Read: Sorting Paginated Results Using a Related Model Field in CakePHP | View: Comments

