Notes on CakePHP HABTM (Part 1, the basics)
Part 1. The basics HABTM seems to give a lot of people trouble, so I wanted to cover a few points that may or may not be in the manual. And I will assume here that you have basic understanding or some...
View ArticlePractical use of saveAll() (part 1, working with multiple models)
(Part 2 is here) I would like to provide some insight on how to use the saveAll() method, with a few real-world examples. First, I’m going to cover how to use saveAll() when working with two related...
View ArticleController makeover (from ugly to beautiful)
Let’s take a controller ridden with problems and see how we can improve it. Hopefully this little experiment can help you beautify your code and optimize your app… This is our ugly Users controller:...
View ArticleHow to build a "dashboard" for your application in CakePHP
As an addition to my recent post, I wanted to share a technique, which should allow you to pretty easily build a “dashboard” for your app. The dashboard would basically grab some information from a few...
View ArticleBlacklist your model fields for save()…
You’ve probably heard that in order to make your save() more secure, you can pass-in a third parameter of only those fields that you’d like to save (all others will be ignored). However, in some cases...
View ArticleA little tip about counterScope
One of many cool CakePHP’s features is the Counter Cache. From the manual: “This function helps you cache the count of related data. Instead of counting the records manually via find(‘count’), the...
View ArticleDealing with dates… reporting, etc.
Once in a while I run into a situation, where some sort of reporting is required for an application… (It happens.) An example?.. We need to get a list of all active users in the DB. Obviously CakePHP...
View Article
More Pages to Explore .....