當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model::beforeValidate方法代碼示例

本文整理匯總了PHP中yii\base\Model::beforeValidate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::beforeValidate方法的具體用法?PHP Model::beforeValidate怎麽用?PHP Model::beforeValidate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\Model的用法示例。


在下文中一共展示了Model::beforeValidate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeValidate

 /**
  * Method description
  *
  * @return mixed The return value
  */
 public function beforeValidate()
 {
     if (!empty($this->otherType)) {
         $this->type = $this->otherType;
     }
     return parent::beforeValidate();
 }
開發者ID:chitwarnold,項目名稱:yii2-wizard,代碼行數:12,代碼來源:Get.php

示例2: beforeValidate

 public function beforeValidate()
 {
     foreach ($this->jsonAttributes as $attribute) {
         $this->jsonValidation($attribute);
     }
     return parent::beforeValidate();
 }
開發者ID:bariew,項目名稱:yii2-config-cms-module,代碼行數:7,代碼來源:Config.php

示例3: beforeValidate

 public function beforeValidate()
 {
     if ($this->is_organization == 1) {
         $this->scenario = 'jur-validate';
     }
     return parent::beforeValidate();
 }
開發者ID:HejVkt,項目名稱:auto.only3.ru,代碼行數:7,代碼來源:Prepare.php

示例4: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->beforeValidateParamRows();
         return true;
     } else {
         return false;
     }
 }
開發者ID:heartshare,項目名稱:yii2-rest-1,代碼行數:9,代碼來源:RequestForm.php

示例5: beforeValidate

 /** @inheritdoc */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->user = User::findIdentityByLogin($this->login);
         return true;
     } else {
         return false;
     }
 }
開發者ID:heartshare,項目名稱:yii2-user-plus,代碼行數:10,代碼來源:BaseLoginForm.php

示例6: beforeValidate

 /** @inheritdoc */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->user = $this->module->manager->findUserByUsernameOrEmail($this->login);
         return true;
     } else {
         return false;
     }
 }
開發者ID:jboy1009,項目名稱:yii2-simple,代碼行數:10,代碼來源:LoginForm.php

示例7: beforeValidate

 public function beforeValidate()
 {
     if ($this->rememberMe == 'on') {
         $this->rememberMe = 1;
     } else {
         $this->rememberMe = 0;
     }
     return parent::beforeValidate();
 }
開發者ID:hoangngk,項目名稱:adminpanel,代碼行數:9,代碼來源:LoginForm.php

示例8: beforeValidate

 /** @inheritdoc */
 public function beforeValidate()
 {
     if (Model::beforeValidate()) {
         $this->user = $this->finder->findUserByEmail($this->email);
         return true;
     } else {
         return false;
     }
 }
開發者ID:itnelo,項目名稱:digitaldali-portal-template-php-yii2,代碼行數:10,代碼來源:LoginForm.php

示例9: beforeValidate

 /** @inheritdoc */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->user = User::findIdentityByUsernameOrEmail(trim($this->login));
         return true;
     } else {
         return false;
     }
 }
開發者ID:yujin1st,項目名稱:yii2-user,代碼行數:10,代碼來源:LoginForm.php

示例10: beforeValidate

 /**
  * @inheritdoc
  */
 public function beforeValidate()
 {
     if (!parent::beforeValidate()) {
         return false;
     }
     foreach ($this->activeAttributes() as $attribute) {
         $this->preparedData[$attribute] = $this->{$attribute};
     }
     return true;
 }
開發者ID:bupy7,項目名稱:yii2-datetime-converter,代碼行數:13,代碼來源:Post.php

示例11: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         if (Yii::$app->getModule('auth')->signupWithEmailOnly) {
             $this->username = $this->email;
         }
         return true;
     }
     return false;
 }
開發者ID:johnparra,項目名稱:yii2-auth,代碼行數:10,代碼來源:SignupForm.php

示例12: beforeValidate

 /**
  * @inheritdoc
  */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         foreach ($this->items as $item) {
             if (!$item->validate()) {
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:dawei101,項目名稱:yii2-admin-module,代碼行數:14,代碼來源:Category.php

示例13: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->prepareRows($this->queryKeys, $this->queryValues, $this->queryActives);
         $this->prepareRows($this->bodyKeys, $this->bodyValues, $this->bodyActives);
         $this->prepareRows($this->headerKeys, $this->headerValues, $this->headerActives);
         return true;
     } else {
         return false;
     }
 }
開發者ID:davidfang,項目名稱:yii2-rest-1,代碼行數:11,代碼來源:RequestForm.php

示例14: beforeValidate

 public function beforeValidate()
 {
     $dateObj = \yii::$app->DateComponent;
     if ($this->end_date == null) {
         $this->end_date = $this->start_date;
     }
     $this->start_datetime_uk = sprintf('%s %s', $this->start_date, $this->start_time);
     $this->end_datetime_uk = sprintf('%s %s', $this->end_date, $this->end_time);
     $this->start_timestamp = $dateObj->ukDateTimeToTimestamp($this->start_datetime_uk);
     $this->end_timestamp = $dateObj->ukDateTimeToTimestamp($this->end_datetime_uk);
     if ($this->end_timestamp - $this->start_timestamp > $this->secsInDay) {
         $this->all_day_option_id = Types::$boolean['true']['id'];
     }
     return parent::beforeValidate();
 }
開發者ID:spiro-stathakis,項目名稱:projects,代碼行數:15,代碼來源:Booking.php

示例15: beforeValidate

 /**
  * Перед валидацией получаем
  * экземпляр объекта файла
  *
  * @return bool
  */
 public function beforeValidate()
 {
     $this->file = UploadedFile::getInstanceByName('file');
     return parent::beforeValidate();
 }
開發者ID:beowulfenator,項目名稱:yii2-dynamic-image,代碼行數:11,代碼來源:ImageUploadForm.php


注:本文中的yii\base\Model::beforeValidate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。