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


PHP Generator::rules方法代码示例

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


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

示例1: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'ns', 'tableName', 'modelClass', 'baseClass', 'queryNs', 'queryClass', 'queryBaseClass'], 'filter', 'filter' => 'trim'], [['ns', 'queryNs'], 'filter', 'filter' => function ($value) {
         return trim($value, '\\');
     }], [['db', 'ns', 'tableName', 'baseClass', 'queryNs', 'queryBaseClass'], 'required'], [['db', 'modelClass', 'queryClass'], 'match', 'pattern' => '/^\\w+$/', 'message' => 'Only word characters are allowed.'], [['ns', 'baseClass', 'queryNs', 'queryBaseClass'], 'match', 'pattern' => '/^[\\w\\\\]+$/', 'message' => 'Only word characters and backslashes are allowed.'], [['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['db'], 'validateDb'], [['ns', 'queryNs'], 'validateNamespace'], [['tableName'], 'validateTableName'], [['modelClass'], 'validateModelClass', 'skipOnEmpty' => false], [['baseClass'], 'validateClass', 'params' => ['extends' => ActiveRecord::className()]], [['queryBaseClass'], 'validateClass', 'params' => ['extends' => ActiveQuery::className()]], [['generateRelations', 'generateLabelsFromComments', 'useTablePrefix', 'useSchemaName', 'generateQuery'], 'boolean'], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false], [['imagesDomain', 'imagesPath'], 'filter', 'filter' => 'trim'], [['imagesPath'], 'filter', 'filter' => function ($value) {
         return trim($value, '/');
     }], [['imagesDomain', 'imagesPath'], 'required'], [['addingI18NStrings'], 'boolean'], [['imagesDomain'], 'match', 'pattern' => '/^(?:[\\w](?:[\\w-]+[\\w])?\\.(?:{\\$domain})|(?:[\\w](?:[0-9\\w\\-\\.]+)?[\\w]\\.[\\w]+))|(?:@[\\w_-]+)$/', 'message' => 'No valid images domain.'], [['messagesPaths'], 'validateMessagesPaths']]);
 }
开发者ID:mervick,项目名称:yii2-adminlte-gii,代码行数:11,代码来源:Generator.php

示例2: rules

 public function rules()
 {
     $rules = ArrayHelper::merge(parent::rules(), [[['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['fields'], MultipleModelValidator::className(), 'baseModel' => Field::className()], [['autoCreateTable', 'useTablePrefix', 'tableNameRequired', 'dropIfExists'], 'boolean'], [['migrationPath', 'migrationCreate', 'migrationName'], 'safe'], [['primaryKeyName', 'fileName'], 'string', 'max' => 20], [['fields'], 'default', 'value' => [new Field(['type' => Schema::TYPE_PK, 'name' => $this->primaryKeyName])]], [['fields'], 'safe']]);
     if ($this->tableNameRequired || $this->autoCreateTable) {
         $rules[] = ['tableName', 'required'];
     }
     return $rules;
 }
开发者ID:infinitydevphp,项目名称:infinity-gii,代码行数:8,代码来源:Generator.php

示例3: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['modelClass', 'fixtureNs', 'fixtureBaseClass', 'dataPath'], 'filter', 'filter' => 'trim'], [['modelClass', 'fixtureBaseClass'], 'required'], [['modelClass'], 'match', 'pattern' => '~^(?:\\w+\\\\)+(?:\\w+|\\*)$~'], [['fixtureNs'], 'default', 'value' => function (Generator $model, $attribute) {
         return preg_replace('~\\\\models\\\\(?:\\w+|\\*)$~', '\\fixtures', $model->modelClass);
     }], [['fixtureNs'], 'match', 'pattern' => '~\\\\fixtures$~'], [['fixtureBaseClass'], 'validateClass', 'params' => ['extends' => 'yii\\boost\\test\\ActiveFixture']], [['generateDataFile'], 'boolean'], [['dataPath'], 'default', 'value' => function (Generator $model, $attribute) {
         return '@' . str_replace('\\', '/', preg_replace('~\\\\fixtures$~', '\\tests\\data', $model->fixtureNs));
     }]]);
 }
开发者ID:ivan-chkv,项目名称:yii2-gii-plus,代码行数:11,代码来源:Generator.php

示例4: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [
         [['moduleID','moduleDir'], 'filter', 'filter' => 'trim'],
         [['moduleDir'], 'required'],
         [['moduleDir'], 'match', 'pattern' => '/^[\w]+$/', 'message' => 'Only word characters'],
         [['moduleID'], 'match', 'pattern' => '/^[\w\\-]+$/', 'message' => 'Only word characters and dashes are allowed.'],
     ]);
 }
开发者ID:huasxin,项目名称:lulucms2,代码行数:12,代码来源:Generator.php

示例5: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['modelClass', 'formModelClass', 'baseClass', 'controllerClass', 'baseControllerClass'], 'filter', 'filter' => 'trim'], [['searchModelClass'], 'compare', 'compareAttribute' => 'modelClass', 'operator' => '!==', 'message' => 'Search Model Class must not be equal to Model Class.'], [['baseClass'], 'required'], [['modelClass', 'modelClass', 'controllerClass', 'baseControllerClass', 'searchModelClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters are allowed.'], [['baseClass'], 'match', 'pattern' => '/^[\\w\\\\]+$/', 'message' => 'Only word characters and backslashes are allowed.'], [['controllerClass', 'searchModelClass'], 'validateNewClass'], [['modelClass', 'formModelClass'], 'validateModelClass', 'skipOnEmpty' => false], [['baseClass', 'modelClass'], 'validateClass', 'params' => ['extends' => Model::className()]], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['controllerClass'], function ($field) {
         if ($this->{$field}) {
             if (!$this->formModelClass) {
                 $this->addError('formModelClass', 'formModelClass required');
             }
             if (!$this->searchModelClass) {
                 $this->addError('searchModelClass', 'searchModelClass required');
             }
         }
     }]]);
 }
开发者ID:myweishanli,项目名称:yii2-gii,代码行数:16,代码来源:Generator.php

示例6: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [
         [['controllerClass', 'modelClass', 'searchModelClass', 'baseControllerClass'], 'filter', 'filter' => 'trim'],
         [['modelClass', 'controllerClass', 'baseControllerClass', 'indexWidgetType'], 'required'],
         [['searchModelClass'], 'compare', 'compareAttribute' => 'modelClass', 'operator' => '!==', 'message' => 'Search Model Class must not be equal to Model Class.'],
         [['modelClass', 'controllerClass', 'baseControllerClass', 'searchModelClass'], 'match', 'pattern' => '/^[\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'],
         [['modelClass'], 'validateClass', 'params' => ['extends' => BaseActiveRecord::className()]],
         [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]],
         [['controllerClass'], 'match', 'pattern' => '/Controller$/', 'message' => 'Controller class name must be suffixed with "Controller".'],
         [['controllerClass'], 'match', 'pattern' => '/(^|\\\\)[A-Z][^\\\\]+Controller$/', 'message' => 'Controller class name must start with an uppercase letter.'],
         [['controllerClass', 'searchModelClass'], 'validateNewClass'],
         [['indexWidgetType'], 'in', 'range' => ['grid', 'list']],
         [['modelClass'], 'validateModelClass'],
         [['enableI18N'], 'boolean'],
         [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false],
         ['viewPath', 'safe'],
     ]);
 }
开发者ID:rzamarripa,项目名称:shabel,代码行数:22,代码来源:Generator.php

示例7: rules

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return array_merge(parent::rules(), [
            [['db', 'ns', 'tableName', 'modelClass', 'baseClass'], 'filter', 'filter' => 'trim'],
            [['ns'], 'filter', 'filter' => function($value) { return trim($value, '\\'); }],

            [['db', 'ns', 'tableName', 'baseClass'], 'required'],
            [['db', 'modelClass'], 'match', 'pattern' => '/^\w+$/', 'message' => 'Only word characters are allowed.'],
            [['ns', 'baseClass'], 'match', 'pattern' => '/^[\w\\\\]+$/', 'message' => 'Only word characters and backslashes are allowed.'],
            [['tableName'], 'match', 'pattern' => '/^(\w+\.)?([\w\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'],
            [['db'], 'validateDb'],
            [['ns'], 'validateNamespace'],
            [['tableName'], 'validateTableName'],
            [['modelClass'], 'validateModelClass', 'skipOnEmpty' => false],
            [['baseClass'], 'validateClass', 'params' => ['extends' => ActiveRecord::className()]],
            [['generateRelations', 'generateLabelsFromComments'], 'boolean'],
            [['enableI18N'], 'boolean'],
            [['useTablePrefix', 'useSchemaName'], 'boolean'],
            [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false],
        ]);
    }
开发者ID:jplagahit,项目名称:brdsdev,代码行数:24,代码来源:Generator.php

示例8: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(\yii\gii\Generator::rules(), [[['moduleID', 'controllerID', 'modelClass', 'searchModelClass', 'baseControllerClass'], 'filter', 'filter' => 'trim'], [['modelClass', 'controllerID', 'baseControllerClass', 'indexWidgetType'], 'required'], [['searchModelClass'], 'compare', 'compareAttribute' => 'modelClass', 'operator' => '!==', 'message' => 'Search Model Class must not be equal to Model Class.'], [['modelClass', 'baseControllerClass', 'searchModelClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['modelClass'], 'validateClass', 'params' => ['extends' => BaseActiveRecord::className()]], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['controllerID'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-\\/]*$/', 'message' => 'Only a-z, 0-9, dashes (-) and slashes (/) are allowed.'], [['searchModelClass'], 'validateNewClass'], [['controllerClass'], 'filter', 'filter' => function () {
         return $this->getControllerClass();
     }, 'skipOnEmpty' => false], [['indexWidgetType'], 'in', 'range' => ['grid', 'list']], [['modelClass'], 'validateModelClass'], [['moduleID'], 'validateModuleID'], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false]]);
 }
开发者ID:cakpep,项目名称:yii2-gii-easyui,代码行数:9,代码来源:Generator.php

示例9: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['controller', 'actions', 'baseClass', 'ns'], 'filter', 'filter' => 'trim'], [['controller', 'baseClass'], 'required'], [['controller'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-\\/]*$/', 'message' => 'Only a-z, 0-9, dashes (-) and slashes (/) are allowed.'], [['actions'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-,\\s]*$/', 'message' => 'Only a-z, 0-9, dashes (-), spaces and commas are allowed.'], [['baseClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['ns'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.']]);
 }
开发者ID:pathman,项目名称:yii2comm,代码行数:7,代码来源:Generator.php

示例10: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'tableName', 'tableIgnore'], 'filter', 'filter' => 'trim'], [['db', 'tableName'], 'required'], [['db'], 'match', 'pattern' => '/^\\w+$/', 'message' => 'Only word characters are allowed.'], [['tableName', 'tableIgnore'], 'match', 'pattern' => '/[^\\w\\*_\\,\\-\\s]/', 'not' => true, 'message' => 'Only word characters, underscore, comma,and optionally an asterisk are allowed.'], [['db'], 'validateDb'], [['tableName'], 'validateTableName'], ['migrationPath', 'safe'], [['usePrefix'], 'boolean'], [['genmode'], 'in', 'range' => ['single', 'mass']]]);
 }
开发者ID:sirroland,项目名称:yii2-migen,代码行数:7,代码来源:Generator.php

示例11: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'migrationPath', 'tableName', 'migrationName', 'migrationTime'], 'filter', 'filter' => 'trim'], [['db', 'migrationPath', 'tableName', 'migrationName', 'migrationTime'], 'required'], [['db', 'migrationName'], 'match', 'pattern' => '/^\\w+$/', 'message' => 'Only word characters are allowed.'], [['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['migrationTime'], 'match', 'pattern' => '/^(\\d{6}_\\d{6})/', 'message' => 'Only format xxxxxx_xxxxxx are allowed.'], [['db'], 'validateDb'], [['tableName'], 'validateTableName'], [['generateRelations'], 'boolean'], [['useTablePrefix'], 'boolean']]);
 }
开发者ID:deesoft,项目名称:yii2-dev,代码行数:7,代码来源:Generator.php

示例12: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['modelClass', 'viewName', 'scenarioName', 'viewPath'], 'filter', 'filter' => 'trim'], [['modelClass', 'viewName', 'viewPath'], 'required'], [['modelClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['modelClass'], 'validateClass', 'params' => ['extends' => Model::className()]], [['viewName'], 'match', 'pattern' => '/^\\w+[\\-\\/\\w]*$/', 'message' => 'Only word characters, dashes and slashes are allowed.'], [['viewPath'], 'match', 'pattern' => '/^@?\\w+[\\-\\/\\w]*$/', 'message' => 'Only word characters, dashes, slashes and @ are allowed.'], [['viewPath'], 'validateViewPath'], [['scenarioName'], 'match', 'pattern' => '/^[\\w\\-]+$/', 'message' => 'Only word characters and dashes are allowed.'], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false]]);
 }
开发者ID:diandianxiyu,项目名称:Yii2Api,代码行数:7,代码来源:Generator.php

示例13: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['modelClass', 'fixtureClass', 'fixtureNs', 'dataPath'], 'filter', 'filter' => 'trim'], [['modelClass', 'fixtureNs', 'dataPath'], 'required'], [['modelClass', 'fixtureNs'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['fixtureClass'], 'match', 'pattern' => '/^\\w+$/', 'message' => 'Only word characters are allowed.'], [['dataFile'], 'match', 'pattern' => '/^\\w+\\.php$/', 'message' => 'Only php files are allowed.'], [['modelClass'], 'validateClass', 'params' => ['extends' => ActiveRecord::className()]], [['dataPath'], 'match', 'pattern' => '/^@?\\w+[\\-\\/\\w]*$/', 'message' => 'Only word characters, dashes, slashes and @ are allowed.'], [['dataPath'], 'validatePath'], [['grabData'], 'boolean']]);
 }
开发者ID:elisdn,项目名称:yii2-gii-fixture-generator,代码行数:7,代码来源:Generator.php

示例14: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['modelClass'], 'required'], [['modelClass', 'baseControllerClass', 'extraActions'], 'filter', 'filter' => 'trim'], [['modelClass', 'controllerClass', 'baseControllerClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['modelClass'], 'validateClass', 'params' => ['extends' => BaseActiveRecord::className()]], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['controllerClass'], 'match', 'pattern' => '/Controller$/', 'message' => 'Controller class name must be suffixed with "Controller".'], [['controllerClass'], 'match', 'pattern' => '/(^|\\\\)[A-Z][^\\\\]+Controller$/', 'message' => 'Controller class name must start with an uppercase letter.'], [['controllerClass'], 'validateNewClass'], [['modelClass'], 'validateModelClass'], [['controllerActionIndexEnabled', 'controllerActionCreateEnabled', 'controllerActionUpdateEnabled', 'controllerActionDeleteEnabled', 'controllerActionApproveEnabled', 'controllerActionDisapproveEnabled', 'controllerActionDeleteSelectedEnabled', 'controllerActionApproveSelectedEnabled', 'controllerActionDisapproveSelectedEnabled', 'controllerActionDetailViewEnabled'], 'boolean', 'on' => 'controller'], ['headingTitle', 'string', 'on' => 'index'], ['columns', 'safe', 'on' => 'index'], [['toolbarCreateButtonEnabled', 'toolbarApproveButtonEnabled', 'toolbarDisapproveButtonEnabled', 'toolbarDeleteButtonEnabled', 'toolbarRefreshButtonEnabled', 'checkboxColumnEnabled', 'actionColumnEnabled', 'actionApproveEnabled', 'actionDisapproveEnabled', 'idColumnEnabled', 'createdColumnEnabled', 'updatedColumnEnabled', 'detailColumnEnabled', 'pjax', 'condensed', 'hover', 'showPageSummary', 'resizableColumns', 'floatHeader', 'perfectScrollbar', 'toggleData', 'showHeader', 'bootstrap', 'bordered', 'striped'], 'boolean', 'on' => 'index'], ['columns', 'safe', 'on' => 'index'], ['columns', 'safe', 'on' => 'index']]);
 }
开发者ID:platx,项目名称:yii2-gii,代码行数:7,代码来源:Generator.php

示例15: rules

 /**
  * Returns the validation rules for attributes.
  *
  * Validation rules are used by [[validate()]] to check if attribute values are valid.
  * Child classes may override this method to declare different validation rules.
  * @return array validation rules
  * @see scenarios()
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['enumerableClass', 'constValues', 'description', 'ns'], 'filter', 'filter' => 'trim'], [['enumerableClass', 'constValues', 'start'], 'required'], [['start'], 'integer'], [['sort'], 'boolean'], [['enumerableClass'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-\\/]*$/', 'message' => 'Only a-z, 0-9, dashes (-) and slashes (/) are allowed.']]);
 }
开发者ID:vals2004,项目名称:yii2-gii-extended,代码行数:12,代码来源:Generator.php


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