Archive for the ‘CakePHP’ Category
Tuesday, February 16th, 2010
CakePHP is great, but the default installation has a performance issue that is very easy to resolve, and should be fixed in any production installation of a CakePHP application. The solution is very simple.
In the default install, there is a file in the webroot called .htaccess. It contains mod_rewrite rules, ...
Posted in CakePHP, Linux | 2 Comments »
Friday, July 31st, 2009
As part of the same project that resulted in my last posting, I needed to write several processes that would be managed by cron. In the past, at the Yahoo contract, we had come up with a way to do this involving a customized version of the basic CakePHP index.php ...
Posted in CakePHP | 11 Comments »
Wednesday, July 29th, 2009
I've written the following behavior for a project I recently completed in Cake, and I thought it would be worth sharing:
class CryptableBehavior extends ModelBehavior {
var $settings = array();
function setup(&$model, $settings) {
if (!isset($this->settings[$model->alias])) {
$this->settings[$model->alias] = array(
'fields' => array()
);
}
$this->settings[$model->alias] = array_merge($this->settings[$model->alias], $settings);
}
function beforeFind(&$model, $queryData) {
foreach ($this->settings[$model->alias]['fields'] AS $field) {
if (isset($queryData['conditions'][$model->alias.'.'.$field])) {
$queryData['conditions'][$model->alias.'.'.$field] = ...
Posted in CakePHP | 9 Comments »
Friday, February 13th, 2009
I was poking through the addons for Firebug today, and liked the look of FirePHP, so I started looking into how I could use it. As many of you know, I'm a big fan of CakePHP as a framework, so I looked up how to integrate the two together and ...
Posted in CakePHP | 8 Comments »
Thursday, January 22nd, 2009
Got some CakePHP models with deep associations that you need to pull into the data that you display when you paginate them? This used to be a royal pain in the butt, and pretty much required custom pagination, but no more!
Behold:
$this->paginate = array(
'Customer' => array(
...
Posted in CakePHP | 2 Comments »