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 »