Hi,
I have a code here (in a model behavior).
function beforeFind(&$model, $queryData)
{
foreach($model->cryptedFields AS $key => $field)
{
if(strstr($queryData['fields'],$field))
{
$queryData['fields'] = str_replace($field,DboSource::expression("AES_DECRYPT({$value}, '{$this->aesKey}')"),$queryData['fields']);
}
}
return $queryData;
}
I want certain fields to be affected with AES_DECRYPT, however, it does not work. When i use print_r on $queryData, it appears that it does not contain any fields in 'fields' at all (i.e. - it is an empty array). The only 2 fields visible are those in conditions. I'm using find('all'); with the second argument as conditions. The beforeSave() function in the same behavior works fine. How do i affect my results with beforeFind?
Thanks