I thought that data cleaning should be done prior to a save, so I
tried using stripAll in the model as follows:
function beforeSave()
{
require_once('sanitize.php');
$cleaner = new Sanitize();
$profile = $this->data;
$fields['Profile'] = $this->getColumnTypes();
foreach ($fields['Profile'] as $k => $v)
{
if (isset($profile['Profile'][$k]))
{
if (($v == 'string') || ($v == 'text'))
{
$fields['Profile'][$k] = $this->RequestHandler-
>stripAll[$profile['Profile'][$k]];
}
else
{
$fields['Profile'][$k] = $profile['Profile'][$k];
}
}
else {
$fields['Profile'][$k] = '';
}
}
$cleaner->cleanArray($fields);
}
But I get this warning:
Undefined property: Profile::$RequestHandler, because the components
array isn't defined in the model. It's in the controller. Any
suggestions on how I might move some of this cleaning work out of the
controller?
Thanks in advance,
Michael Tuzi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---