public function beforeSave($insert) { if (parent::beforeSave($insert)) { //ssn加密 if ($this->social_security_number) { $this->social_security_number = Aes::encode($this->social_security_number); } } return true; }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->getAttribute('delete') == 1 && $this->getOldAttribute('delete') == 0) { if ($this->applications) { return false; } } return true; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->requested_date = time(); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->getAttribute('delete') == 1 && $this->getOldAttribute('delete') == 0) { if (isset($this->advisor)) { if ($applications = $this->advisor->primaryApplications) { $idGroupArray = ArrayHelper::map($applications, 'id_group', 'id_group'); foreach ($idGroupArray as $idGroup) { if ($idGroup == $this->id_group) { return false; } } } } } return true; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { //applicant创建时与client同步数据 if ($insert) { $clientModel = $this->client; $this->load([$this->formName() => $clientModel->getAttributes()]); } $this->date_of_birth = is_numeric($this->date_of_birth) ? $this->date_of_birth : strtotime($this->date_of_birth); $this->identification_expiration_date = is_numeric($this->identification_expiration_date) ? $this->identification_expiration_date : strtotime($this->identification_expiration_date); //ssn加密 if ($this->social_security_number) { $this->social_security_number = Aes::encode($this->social_security_number); } } return true; }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->getIsNewRecord()) { $this->setPassword($this->password_hash); } return true; } else { return false; } }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->primary_advisor = Yii::$app->user->getId(); $supernovaModel = BetterDebt::findOne(['is_primary_service_member' => 1]); if (!$supernovaModel) { $supernovaModel = BetterDebt::findOne(['is_in_service_team' => 1]); } if (!$supernovaModel) { $supernovaModel = BetterDebt::find()->one(); } $this->primary_supernova = $supernovaModel->id_user; } } return true; }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { //置空未选择的账户类型相关字段 if (!$this->is_trust_account) { $this->trust_name = ''; $this->names_of_grantors = ''; $this->names_of_trustees = ''; $this->tax_id = ''; $this->address_street = ''; $this->address_state_where_organized = ''; $this->address_city = ''; $this->address_state = ''; $this->address_zip_code = ''; $this->trustee_phone_number = ''; } if (!$this->has_regular_distribution) { $this->payee = ''; $this->regular_distribution_amount = ''; } } return true; }