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


PHP ActiveRecord::beforeValidate方法代码示例

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


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

示例1: beforeValidate

 public function beforeValidate()
 {
     // Alias
     if ($this->alias) {
         $this->alias = makeAlias($this->alias);
     } else {
         $this->alias = makeAlias($this->question);
     }
     if ($this->isNewRecord) {
         // Check if we already have an alias with those parameters
         if (HelpTopic::model()->exists('alias=:alias', array(':alias' => $this->alias))) {
             $this->addError('alias', at('There is already a help topic with that alias.'));
         }
     } else {
         // Check if we already have an alias with those parameters
         if (HelpTopic::model()->exists('alias=:alias AND id!=:id', array(':id' => $this->id, ':alias' => $this->alias))) {
             $this->addError('alias', at('There is already a help topic with that alias.'));
         }
     }
     return parent::beforeValidate();
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:21,代码来源:HelpTopic.php

示例2: beforeValidate

 public function beforeValidate()
 {
     /*		//date_default_timezone_set('America/Caracas');
         	$this->actualizado_el = date('d/m/Y h:i:s a', time());
     
         	if($this->isNewRecord)
      			$this->creado_el = $this->actualizado_el;*/
     //$this->usuario = strtolower($this->usuario);
     //$this->correo = strtolower($this->correo);
     return parent::beforeValidate();
 }
开发者ID:EurekaSolutions,项目名称:sistemanc,代码行数:11,代码来源:Usuarios.php

示例3: beforeValidate

 public function beforeValidate()
 {
     if (!empty($this->birthdate_day) || !empty($this->birthdate_month) || !empty($this->birthdate_year)) {
         $this->birthdate = $this->birthdate_year . "-" . $this->birthdate_month . "-" . $this->birthdate_day;
     }
     return parent::beforeValidate();
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:Person.php

示例4: beforeValidate

 protected function beforeValidate()
 {
     $this->handleDate();
     return parent::beforeValidate();
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:5,代码来源:Faq.php

示例5: beforeValidate

 public function beforeValidate()
 {
     // For configurable product set 0 price
     if ($this->use_configurations) {
         $this->price = 0;
     }
     return parent::beforeValidate();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:ShopProduct.php

示例6: beforeValidate

 public function beforeValidate()
 {
     $this->userId = Yii::app()->user->id;
     return parent::beforeValidate();
 }
开发者ID:arossokha,项目名称:ex-comment,代码行数:5,代码来源:Feedback.php

示例7: beforeValidate

 /**
  * @return bool
  */
 public function beforeValidate()
 {
     // Save phone as imploded string
     if (!empty($this->phone_numbers)) {
         $this->phone = implode(',', $this->phone_numbers);
     }
     return parent::beforeValidate();
 }
开发者ID:septembermd,项目名称:n1,代码行数:11,代码来源:User.php

示例8: beforeValidate

 protected function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->create_time = $this->update_time = time();
         if (!$this->order_no) {
             $this->order_no = sprintf('%s-%d-%06d-%05d', date('YmdHis', $this->create_time), $this->type, $this->sub_type_id, mt_rand(10000, 99999));
         }
     }
     return parent::beforeValidate();
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:10,代码来源:Pay.php

示例9: beforeValidate

 public function beforeValidate()
 {
     foreach (array('phone', 'fax', 'workPhone') as $attr) {
         if (is_array($this->{$attr})) {
             foreach ($this->{$attr} as $k => &$it) {
                 $it = trim($it);
                 if ($k == 3) {
                     $it = '(' . $it . ')';
                 }
             }
             $this->{$attr} = implode(' ', $this->{$attr});
             if (strlen($this->{$attr}) < 5) {
                 $this->{$attr} = '';
             }
         }
     }
     if ($this->url == 'http://') {
         $this->url = '';
     }
     if (!$this->confirmCode) {
         $this->confirmCode = md5($this->email . time() . time());
     }
     if ($this->password) {
         $this->password = Security::cryptPassword($this->password, '1');
     }
     if ($this->isNewRecord) {
         $this->created_timestamp = date('Y-m-d H:i:s');
     }
     return parent::beforeValidate();
 }
开发者ID:arossokha,项目名称:ex-comment,代码行数:30,代码来源:User.php

示例10: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate() && $this->isNewRecord) {
         $user = User::model()->findByPk($this->user_id);
         $template = MailerTemplate::model()->findByPk($this->template_id);
         if (!$this->subject) {
             $this->subject = $template->constructSubject($user);
         }
         if (!$this->body) {
             $this->body = $template->constructBody($user);
         }
         if (!$this->email) {
             $this->email = $user->email;
         }
     }
     return true;
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:17,代码来源:MailerOutbox.php


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