function beforeSave($options = array())
{
// $fieldsの設定でSanitize
- foreach($this->data[$this->name] as $field => $value) {
- $this->data[$this->name][$field] = $this->escapeByFields($field, $value);
+ if (isset($this->data[$this->name])) {
+ foreach($this->data[$this->name] as $field => $value) {
+ $this->data[$this->name][$field] = $this->escapeByFields($field, $value);
+ }
+ // Sanitize(不正コード、SQL Injection)
+ $this->data = Sanitize::clean(
+ $this->data,
+ array(
+ 'encode' => false,
+ )
+ );
}
- // Sanitize(不正コード、SQL Injection)
- $this->data = Sanitize::clean(
- $this->data,
- array(
- 'encode' => false,
- )
- );
return parent::beforeSave($options);
}