BaseActiveRecord::beforeSave PHP Method

beforeSave() protected method

Strips all html tags out of attributes to be saved.
protected beforeSave ( ) : boolean
return boolean
    protected function beforeSave()
    {
        // Detect nullable foreign keys and replace "" with null (to fix html dropdowns breaking contraints)
        foreach ($this->tableSchema->foreignKeys as $field => $stuff) {
            if ($this->tableSchema->columns[$field]->allowNull && !$this->{$field}) {
                $this->{$field} = null;
            }
        }
        return parent::beforeSave();
    }

Usage Example

 protected function beforeSave()
 {
     return parent::beforeSave();
 }
All Usage Examples Of BaseActiveRecord::beforeSave