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


PHP CActiveRecord::hasErrors方法代碼示例

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


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

示例1: assertSaves

 /**
  * Assert thet the model can be saved without error and, if errors are present, print
  * out the corresponding error messages.
  * @param CActiveRecord $model
  */
 public function assertSaves(CActiveRecord $model)
 {
     $saved = $model->save();
     if ($model->hasErrors()) {
         VERBOSE_MODE && print_r($model->getErrors());
     }
     $this->assertTrue($saved);
 }
開發者ID:keyeMyria,項目名稱:CRM,代碼行數:13,代碼來源:X2TestCase.php

示例2: checkErrors

 /**
  *### .checkErros()
  *
  * errors as CHttpException
  * @internal param $msg
  */
 public function checkErrors()
 {
     if ($this->model->hasErrors()) {
         $msg = array();
         foreach ($this->model->getErrors() as $attribute => $errors) {
             $msg = array_merge($msg, $errors);
         }
         //todo: show several messages. should be checked in x-editable js
         //$this->error(join("\n", $msg));
         $this->error($msg[0]);
     }
 }
開發者ID:robebeye,項目名稱:isims,代碼行數:18,代碼來源:TbEditableSaver.php

示例3: checkErrors

 /**
  *### .checkErros()
  *
  * errors as CHttpException
  * @internal param $msg
  * @throws CHttpException
  */
 public function checkErrors()
 {
     if (!$this->model->hasErrors()) {
         return;
     }
     $msg = array();
     foreach ($this->model->getErrors() as $attribute => $errors) {
         // TODO: make use of $attribute elements
         $msg = array_merge($msg, $errors);
     }
     $this->error($msg[0]);
 }
開發者ID:zhaoyan158567,項目名稱:YiiBooster,代碼行數:19,代碼來源:TbEditableSaver.php

示例4: beforeUpdate

 /**
  * beforeUpdate
  *
  */
 protected function beforeUpdate()
 {
     $this->onBeforeUpdate(new CEvent($this));
     return !$this->model->hasErrors();
 }
開發者ID:janym,項目名稱:angular-yii,代碼行數:9,代碼來源:TbEditableSaver.php

示例5: assertSaves

 /**
  * Assert thet the model can be saved without error and, if errors are present, print
  * out the corresponding error messages.
  * @param CActiveRecord $model
  */
 public function assertSaves(CActiveRecord $model)
 {
     $saved = $model->save();
     if ($model->hasErrors()) {
         X2_TEST_DEBUG_LEVEL > 1 && print_r($model->getErrors());
     }
     $this->assertTrue($saved);
 }
開發者ID:dsyman2,項目名稱:X2CRM,代碼行數:13,代碼來源:X2TestCase.php

示例6: textInputFull

 public static function textInputFull(CActiveRecord $model, $fieldName, $options = array())
 {
     $containerCss = '';
     $options['class'] = 'form-control';
     if (array_key_exists('inputClass', $options)) {
         $options['class'] .= " {$options['inputClass']}";
         unset($options['inputClass']);
     }
     if (array_key_exists('fieldColumn', $options)) {
         $columns = $options['fieldColumn'];
         unset($options['fieldColumn']);
     } else {
         $columns = self::$fullColumn;
     }
     $errorHelp = '';
     if ($model->hasErrors($fieldName)) {
         $containerCss .= ' has-error';
         $errorHelp = '<span class="help-block">' . $model->getError($fieldName) . '</span>';
     }
     $str = "<div class=\"form-group{$containerCss}\">";
     if (array_key_exists('hasLabel', $options)) {
         $str .= '<div class="input-caption col-md-' . $columns . '">' . CHtml::activeLabelEx($model, $fieldName, array('class' => 'control-label')) . '</div>';
         unset($options['hasLabel']);
     }
     $str .= "<div class=\"col-md-{$columns}\">" . CHtml::activeTextField($model, $fieldName, $options) . "{$errorHelp}</div></div>";
     return $str;
 }
開發者ID:junctionaof,項目名稱:thanagornfarm,代碼行數:27,代碼來源:TRHtml.php


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