zen of coding

Let's help out CakePHP's pagination

While it would be sweet, if the paginated data was usually not much more involved than a simple SELECT * FROM some_table… Unfortunately it is not. In many cases there are a few, JOINs to related models, and likely a GROUP BY statement somewhere (maybe DISTINCT ?, who knows). What[…]

Read More »

Make updateAll() fire behavior callbacks

For a while now updateAll() would not trigger any of the model’s behavior callbacks. This presents a problem for a couple of reasons: The updateAll() method allows to easily do things like field_value = field_value + 1, because unlike other similar methods it does not escape fields/values Secondly we cannot[…]

Read More »

Quickly grant Auth access to multiple controllers

Common way to allow Auth access to all actions in a controller is to do something like this: [cc lang=”php”] //In some controller public function beforeFilter() { $this->Auth->allow(‘*’); parent::beforeFilter(); } [/cc] However it can get pretty tedious if you’ve got lots of controllers and have to go through a bunch[…]

Read More »
%d bloggers like this: