public function beforeValidate() { if ($this->isNewRecord) { $this->sms_command_status = self::STATUS_NEW; } return parent::beforeValidate(); }
public function beforeValidate() { $this->destination_local_folder = $this->method === 'local_folder' ? $this->destination_local_folder : ''; $this->destination_ip = $this->method === 'ftp' ? $this->destination_ip : ''; $this->destination_ip_port = $this->method === 'ftp' ? $this->destination_ip_port : 21; $this->destination_ip_user = $this->method === 'ftp' ? $this->destination_ip_user : ''; $this->destination_ip_password = $this->method === 'ftp' ? $this->destination_ip_password : ''; $this->destination_ip_folder = $this->method === 'ftp' ? $this->destination_ip_folder : ''; $this->destination_email = $this->method === 'mail' ? $this->destination_email : ''; foreach ($this->attributes as $key => $value) { $this->{$key} = trim($value); } return parent::beforeValidate(); }
public function beforeValidate() { foreach ($this->attributes as $key => $value) { $this->{$key} = trim($value); } if ($this->scenario == 'dbexport') { $this->db_exp_sql_host = $this->db_exp_enabled ? $this->db_exp_sql_host : ''; $this->db_exp_sql_port = $this->db_exp_enabled ? $this->db_exp_sql_port : ''; $this->db_exp_sql_dbname = $this->db_exp_enabled ? $this->db_exp_sql_dbname : ''; $this->db_exp_sql_login = $this->db_exp_enabled ? $this->db_exp_sql_login : ''; $this->db_exp_sql_password = $this->db_exp_enabled ? $this->db_exp_sql_password : ''; } return parent::beforeValidate(); }
public function beforeValidate() { foreach (array('station_id_code', 'station_type', 'communication_type', 'communication_port', 'communication_esp_ip', 'communication_esp_port', 'display_name', 'details', 'timezone_id', 'station_number', 'wmo_block_number', 'wmo_block_number', 'wmo_member_state_id', 'national_aws_number', 'altitude', 'awos_msg_source_folder') as $value) { $this->{$value} = trim($this->{$value}); } $this->national_aws_number = $this->national_aws_number ? $this->national_aws_number : ''; $this->communication_esp_port = $this->communication_esp_port ? $this->communication_esp_port : 0; return parent::beforeValidate(); }