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


PHP BaseModel::rules方法代码示例

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


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

示例1: rules

 /**
  * Returns this model's validation rules.
  *
  * @return array
  */
 public function rules()
 {
     $rules = parent::rules();
     // Use Yii's stricter URL validator here
     $rules[] = array('url', 'url');
     return $rules;
 }
开发者ID:jmstan,项目名称:craft-website,代码行数:12,代码来源:UrlModel.php

示例2: rules

 /**
  * Define validation rules
  *
  * @return array with validation rules
  */
 public function rules()
 {
     // add the custom validator for validating Project Id
     $rules = parent::rules();
     $rules[] = array('projectId', 'Craft\\Optimizely_ProjectIdValidator');
     return $rules;
 }
开发者ID:aiaio,项目名称:Craft-Optimizely,代码行数:12,代码来源:Optimizely_SettingsModel.php

示例3: rules

 /**
  * @inheritDoc BaseModel::rules()
  *
  * @return array
  */
 public function rules()
 {
     $rules = parent::rules();
     if ($this->urlFormatIsRequired) {
         $rules[] = array('urlFormat', 'required');
     }
     if ($this->nestedUrlFormatIsRequired) {
         $rules[] = array('nestedUrlFormat', 'required');
     }
     return $rules;
 }
开发者ID:sweetroll,项目名称:craft-test,代码行数:16,代码来源:CategoryGroupLocaleModel.php

示例4: rules

 /**
  * @inheritDoc BaseModel::rules()
  *
  * @return array
  */
 public function rules()
 {
     $rules = parent::rules();
     if ($this->decimals && intval($this->decimals) && intval($this->decimals) > 0) {
         foreach ($rules as $key => &$rule) {
             if (isset($rule[0]) && isset($rule[1]) && ($rule[0] == 'min' || $rule[0] == 'max') && $rule[1] == 'numerical') {
                 $rule['integerOnly'] = false;
             }
         }
     }
     return $rules;
 }
开发者ID:codeforamerica,项目名称:oakland-beta,代码行数:17,代码来源:NumberFieldTypeSettingsModel.php

示例5: rules

 /**
  * @inheritDoc BaseModel::rules()
  *
  * @return array
  */
 public function rules()
 {
     $rules = parent::rules();
     if ($this->expectedPrice == 0) {
         // CC info not required
         foreach ($rules as &$rule) {
             if ($rule[1] == 'required') {
                 $attributes = explode(',', $rule[0]);
                 foreach (array('ccTokenId', 'expMonth', 'expYear') as $attribute) {
                     $pos = array_search($attribute, $attributes);
                     if ($pos !== false) {
                         array_splice($attributes, $pos, 1);
                     }
                 }
                 $rule[0] = implode(',', $attributes);
                 break;
             }
         }
     }
     return $rules;
 }
开发者ID:jmstan,项目名称:craft-website,代码行数:26,代码来源:UpgradePurchaseModel.php

示例6: rules

 public function rules()
 {
     $rules = parent::rules();
     $rules[] = ['numberOfCrops', 'validateNumberOfCrops'];
     return $rules;
 }
开发者ID:rabble-rouser,项目名称:image-cropper-plugin,代码行数:6,代码来源:ImageCropper_SettingsModel.php

示例7: rules

 public function rules()
 {
     // maxSize is 3MB
     return array_merge(parent::rules(), array(array('attachment', 'file', 'maxSize' => 3145728, 'allowEmpty' => true)));
 }
开发者ID:EP-NY,项目名称:FeedMe,代码行数:5,代码来源:FeedMe_GetHelpModel.php


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