当前位置: 首页>>代码示例>>PHP>>正文


PHP CActiveRecord::beforeValidate方法代码示例

本文整理汇总了PHP中CActiveRecord::beforeValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::beforeValidate方法的具体用法?PHP CActiveRecord::beforeValidate怎么用?PHP CActiveRecord::beforeValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CActiveRecord的用法示例。


在下文中一共展示了CActiveRecord::beforeValidate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeValidate

 public function beforeValidate()
 {
     parent::beforeValidate();
     $this->usuario_id = Yii::app()->user->id;
     $this->data_cadastro = date('dd/mm/yy');
     return true;
 }
开发者ID:rhokrecife,项目名称:sosdefesacivil,代码行数:7,代码来源:Senha.php

示例2: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->product_last_update = new CDbExpression('NOW()');
     }
     return parent::beforeValidate();
 }
开发者ID:adsavin,项目名称:yii11,代码行数:7,代码来源:Product.php

示例3: beforeValidate

 public function beforeValidate()
 {
     if (Yii::app()->language == 'de') {
         $this->price = str_replace(',', '.', $this->price);
     }
     return parent::beforeValidate();
 }
开发者ID:rinodung,项目名称:yii-shop,代码行数:7,代码来源:Products.php

示例4: beforeValidate

 protected function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->date = time();
     }
     return true;
 }
开发者ID:parxtan,项目名称:gdeskidki,代码行数:7,代码来源:User.php

示例5: beforeValidate

 /**
  * Prepares create_time, create_user_id, update_time and
  * update_user_ id attributes before performing validation.
  */
 protected function beforeValidate()
 {
     if ($this->isNewRecord) {
         // set the create date, last updated date
         // and the user doing the creating
         if ($this->id == null) {
             $this->id = $this->createUUID();
         }
         $this->created_time = $this->updated_time = new CDbExpression('NOW()');
         if ($this->created_by == null) {
             $this->created_by = Yii::app()->user->id;
         }
         if ($this->updated_by == null) {
             $this->updated_by = Yii::app()->user->id;
         }
     } else {
         //not a new record, so just set the last updated time
         //and last updated user id
         $this->updated_time = new CDbExpression('NOW()');
         //$this->updated_by = Yii::app()->user->id;
         if ($this->updated_by == null) {
             $this->updated_by = Yii::app()->user->id;
         }
     }
     return parent::beforeValidate();
 }
开发者ID:aer123456,项目名称:yougou,代码行数:30,代码来源:WexActiveRecord.php

示例6: beforeValidate

 /**
  * Prepares id, status, date_entered, created_by, date_modified and 
  * modified_user_id,deleted attributes before performing validation.
  */
 protected function beforeValidate()
 {
     if ($this->isNewRecord) {
         // set the create date, last updated date and the user doing the creating
         if (create_guid()) {
             $this->id = create_guid();
             $this->date_entered = date("Y-m-d H:i:s");
             if (frontUserId()) {
                 $this->created_by = frontUserId();
                 $this->modified_by = frontUserId();
             } else {
                 $this->created_by = $this->id;
                 $this->modified_by = $this->id;
             }
             $this->deleted = 0;
             //$this->status = 0;
             $this->date_modified = date("Y-m-d H:i:s");
         }
     } else {
         //not a new record, so just set the last updated time and last updated user id
         $this->date_modified = date("Y-m-d H:i:s");
         if (frontUserId()) {
             $this->modified_by = frontUserId();
         } else {
             $this->modified_by = Yii::app()->user->id;
         }
     }
     return parent::beforeValidate();
 }
开发者ID:priyranjansingh,项目名称:donation,代码行数:33,代码来源:FrontBaseModel.php

示例7: beforeValidate

 public function beforeValidate()
 {
     if ($this->getScenario() == 'insert') {
         $this->sal = uniqid();
     }
     return parent::beforeValidate();
 }
开发者ID:BrunoCheble,项目名称:novopedido,代码行数:7,代码来源:Usuario.php

示例8: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->ordering_date = $this->convertDate($this->ordering_date);
     }
     return parent::beforeValidate();
 }
开发者ID:archieDeveloper,项目名称:yii-shop,代码行数:7,代码来源:Order.php

示例9: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->ordering = $this->getNextOrdering();
     }
     return parent::beforeValidate();
 }
开发者ID:aldegtyarev,项目名称:zru,代码行数:7,代码来源:Bookmarks.php

示例10: beforeValidate

 protected function beforeValidate()
 {
     if (!parent::beforeValidate()) {
         return false;
     }
     if ($this->scenario == "fromAdmin") {
         if ($this->teacher_path_file == NULL) {
             $this->addError("teacher_avatar", "teacher_avatar is required");
             return false;
         }
         if (!$this->teacher_path_file->checkExt(array('jpg', 'jpeg', 'png', 'JPG', 'JPEG', 'PNG'))) {
             return FALSE;
         }
         $ext = $this->teacher_path_file->getExtension();
         $name = StringHelper::unicode_str_filter($this->teacher_path_file->name);
         $storeFolder = Yii::getPathOfAlias('webroot') . '/uploads/teacher/';
         $targetPath = $storeFolder;
         //4
         $teacher_ava = Yii::app()->createAbsoluteUrl('uploads') . '/teacher/' . $name;
         if ($ext == "gif" || $ext == "jpg" || $ext == "jpeg" || $ext == "pjepg" || $ext == "png" || $ext == "x-png" || $ext == "GIF" || $ext == "JPG" || $ext == "JPEG" || $ext == "PJEPG" || $ext == "PNG" || $ext == "X_PNG") {
             $this->teacher_path_file->save($targetPath, $name);
             $this->teacher_avatar = $teacher_ava;
         }
     }
     return TRUE;
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:26,代码来源:Teacher.php

示例11: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->member_created_date = new CDbExpression("NOW()");
     }
     return parent::beforeValidate();
 }
开发者ID:Alfiriny,项目名称:jpos2015-opensource,代码行数:7,代码来源:Member.php

示例12: beforeValidate

 public function beforeValidate()
 {
     if (!Yii::app()->getModule('messaging')->hasGroup($this->grp)) {
         $this->addError('grp', 'You are not part of this group.');
     }
     return parent::beforeValidate();
 }
开发者ID:rubensworks,项目名称:yii-messaging,代码行数:7,代码来源:Message.php

示例13: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord && $this->keyword === null) {
         $this->keyword = AdminHelper::generateUrlStr($this->alias, $this, 'keyword');
     }
     return parent::beforeValidate();
 }
开发者ID:kostya1017,项目名称:our,代码行数:7,代码来源:CmsAlias.php

示例14: beforeValidate

 protected function beforeValidate()
 {
     if (empty($this->user_id)) {
         $this->user_id = Yii::app()->user->id;
     }
     return parent::beforeValidate();
 }
开发者ID:biniyamz,项目名称:yii_cms,代码行数:7,代码来源:File.php

示例15: beforeValidate

 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->hash = Yii::app()->functions->makeHash(6);
     }
     return parent::beforeValidate();
 }
开发者ID:newga,项目名称:newga,代码行数:7,代码来源:Campaign.php


注:本文中的CActiveRecord::beforeValidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。