Esempio n. 1
2
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['loginModelClass', 'controllerClass', 'viewPath'], 'filter', 'filter' => 'trim'], [['loginModelClass', 'controllerClass', 'viewPath'], 'required'], [['loginModelClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['loginModelClass'], 'validateClass', 'params' => ['extends' => Model::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'], [['viewPath'], 'match', 'pattern' => '/^@?\\w+[\\-\\/\\w]*$/', 'message' => 'Only word characters, dashes, slashes and @ are allowed.'], [['viewPath'], 'validatePath'], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false]]);
 }
Esempio n. 2
0
 /**
  * @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']]);
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['ns', 'layoutsPath', 'defaultController'], 'filter', 'filter' => 'trim'], [['ns'], 'match', 'pattern' => '/^[\\w\\\\]+$/', 'message' => 'Only word characters and backslashes are allowed.'], [['defaultController'], 'match', 'pattern' => '/^\\w+$/', 'message' => 'Only word characters are allowed.'], [['ns', 'layoutsPath', 'defaultController'], 'required'], [['ns'], 'filter', 'filter' => function ($value) {
         return trim($value, '\\');
     }], [['layoutsPath'], 'filter', 'filter' => function ($value) {
         return trim($value, '/');
     }], [['defaultController'], 'match', 'pattern' => '/Controller$/', 'message' => 'Controller class name must be suffixed with "Controller".'], [['defaultController'], 'match', 'pattern' => '/(^|\\\\)[A-Z][^\\\\]+Controller$/', 'message' => 'Controller class name must start with an uppercase letter.'], [['enableI18N'], 'boolean'], [['ns'], 'validateNamespace'], [['layoutsPath'], 'validateLayoutsPath'], [['defaultController'], 'validateDefaultController']]);
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 /**
  * @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));
     }]]);
 }
Esempio n. 6
0
 /**
  * @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.'],
     ]);
 }
Esempio n. 7
0
 /**
  * @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');
             }
         }
     }]]);
 }
Esempio n. 8
0
 /**
  * @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'],
     ]);
 }
Esempio n. 9
0
    /**
     * @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],
        ]);
    }
Esempio n. 10
0
 /**
  * @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.']]);
 }
Esempio n. 11
0
 /**
  * @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']]);
 }
Esempio n. 12
0
 public function rules()
 {
     return ArrayHelper::merge(parent::rules(), []);
 }
Esempio n. 13
0
 /**
  * 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', 'ns'], 'filter', 'filter' => 'trim'], [['enumerableClass', 'constValues', 'start'], 'required'], [['start'], 'integer'], [['sort'], 'boolean'], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false], [['enumerableClass'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-\\/]*$/', 'message' => 'Only a-z, 0-9, dashes (-) and slashes (/) are allowed.']]);
 }
Esempio n. 14
0
 /**
  * @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']]);
 }
Esempio n. 15
0
 /**
  * @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]]);
 }
Esempio n. 16
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['controllerClass', 'actions', 'baseClass'], 'filter', 'filter' => 'trim'], [['controllerClass', 'baseClass'], 'required'], ['controllerClass', 'match', 'pattern' => '/^[\\w\\\\]*Controller$/', 'message' => 'Only word characters and backslashes are allowed, and the class name must end with "Controller".'], ['controllerClass', 'validateNewClass'], ['baseClass', 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], ['actions', 'match', 'pattern' => '/^[a-z][a-z0-9\\-,\\s]*$/', 'message' => 'Only a-z, 0-9, dashes (-), spaces and commas are allowed.'], ['viewPath', 'safe']]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), []);
 }
Esempio n. 18
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'tableName', 'migrationName'], 'filter', 'filter' => 'trim'], [['migrationPath'], 'filter', 'filter' => function ($value) {
         return rtrim($value, '/');
     }], [['db', 'migrationName', 'migrationPath'], '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.'], [['db'], 'validateDb'], [['tableName'], 'validateTableName'], [['generateRelations'], 'boolean'], [['enableI18N'], 'boolean'], [['useTablePrefix'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false]]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'nsModel', 'viewPath', 'queryNs', 'nsController', 'nsSearchModel', 'tableName', 'modelClass', 'searchModelClass', 'baseControllerClass'], 'filter', 'filter' => 'trim'], [['tableName', 'baseControllerClass', 'indexWidgetType', 'db'], 'required'], [['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['tableName'], 'validateTableName'], [['modelClass', 'baseControllerClass', 'searchModelClass', 'db', 'queryClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['db'], 'validateDb'], [['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.'], [['indexWidgetType'], 'in', 'range' => ['grid', 'list']], [['enableI18N', 'generateRelations', 'generateSearchModel', 'pluralize', 'expandable', 'exportable', 'pdf', 'loggedUserOnly'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false], [['viewPath', 'skippedRelations', 'skippedColumns', 'controllerClass', 'blameableValue', 'nameAttribute', 'hiddenColumns', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy', 'UUIDColumn'], 'safe']]);
 }
Esempio n. 20
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['type'], 'in', 'range' => static::$types, 'skipOnEmpty' => false], [['moduleID', 'moduleClass', 'moduleName'], 'filter', 'filter' => 'trim'], [['moduleID', 'moduleName', 'moduleClass', 'version'], 'required'], [['moduleID'], 'match', 'pattern' => '/^[\\w]+$/', 'message' => '{attribute}只能包含字母,数字和_符号'], [['moduleClass'], 'validateModuleClass'], [['version'], 'match', 'pattern' => '/^\\d+[.\\d]+\\d+$/', 'message' => '{attribute}只能包含数字和.符号并符合版本命名规则, 例如<code>1.0.0</code>'], [['migration', 'admin', 'replyRule'], 'boolean'], [['author'], 'string', 'max' => 50], [['site'], 'string', 'max' => 255], [['category'], 'in', 'range' => array_keys($this->getCategories()), 'skipOnEmpty' => false]]);
 }
 /**
  * @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']]);
 }
Esempio n. 22
0
 /**
  * @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']]]);
 }
Esempio n. 23
0
 /**
  * @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]]);
 }
Esempio n. 24
0
 /**
  * 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.']]);
 }
Esempio n. 25
0
 public function rules()
 {
     $rules = ArrayHelper::merge(parent::rules(), [[['tableName'], 'required'], [['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()], [['useTablePrefix'], 'boolean'], [['migrationPath', 'migrationName'], 'safe']]);
     return $rules;
 }
Esempio n. 26
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['vendorName', 'packageName'], 'filter', 'filter' => 'trim'], [['vendorName', 'packageName', 'namespace', 'type', 'license', 'title', 'description', 'authorName', 'authorEmail', 'outputPath'], 'required'], [['keywords'], 'safe'], [['authorEmail'], 'email'], [['vendorName', 'packageName'], 'match', 'pattern' => '/^[a-z0-9\\-\\.]+$/', 'message' => 'Only lowercase word characters, dashes and dots are allowed.'], [['namespace'], 'match', 'pattern' => '/^[a-zA-Z0-9\\\\]+\\\\$/', 'message' => 'Only letters, numbers and backslashes are allowed. PSR-4 namespaces must end with a namespace separator.']]);
 }
Esempio n. 27
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'ns', 'collectionName', 'databaseName', 'attributeList', 'modelClass', 'baseClass'], 'filter', 'filter' => 'trim'], [['ns'], 'filter', 'filter' => function ($value) {
         return trim($value, '\\');
     }], [['db', 'ns', 'collectionName', '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.'], [['collectionName'], 'match', 'pattern' => '/^[^$ ]+$/', 'message' => 'Collection name can not contain spaces or "$" symbols.'], [['databaseName'], 'match', 'pattern' => '/^[^\\/\\\\\\. "*:?\\|<>]+$/', 'message' => 'Database name can not contain spaces or any of "/\\."*<>:|?" symbols.'], [['db'], 'validateDb'], [['ns'], 'validateNamespace'], [['collectionName'], 'validateCollectionName'], [['attributeList'], 'match', 'pattern' => '/^(\\w+\\,[ ]*)*([\\w]+)$/', 'message' => 'Attributes should contain only word characters, and should be separated by coma.'], [['modelClass'], 'validateModelClass', 'skipOnEmpty' => false], [['baseClass'], 'validateClass', 'params' => ['extends' => ActiveRecord::className()]], [['enableI18N'], 'boolean'], [['messageCategory'], 'validateMessageCategory', 'skipOnEmpty' => false]]);
 }
Esempio n. 28
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['moduleID', 'controllerID', 'actions', 'formActions', 'baseControllerClass'], 'filter', 'filter' => 'trim'], [['controllerID', 'baseControllerClass'], 'required'], [['controllerID'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-\\/]*$/', 'message' => 'Only a-z, 0-9, dashes (-) and slashes (/) are allowed.'], [['actions', 'formActions'], 'match', 'pattern' => '/^[a-z][a-z0-9\\-,\\s]*$/', 'message' => 'Only a-z, 0-9, dashes (-), spaces and commas are allowed.'], [['baseControllerClass', 'modelClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['scenarioName'], 'match', 'pattern' => '/^[\\w\\-]+$/', 'message' => 'Only word characters and dashes are allowed.'], [['modelClass'], 'validateClass', 'params' => ['extends' => Model::className()]], [['moduleID'], 'validateModuleID']]);
 }
Esempio n. 29
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['moduleID', 'moduleClass'], 'filter', 'filter' => 'trim'], [['moduleID', 'moduleClass'], 'required'], [['moduleID'], 'match', 'pattern' => '/^[\\w\\-]+$/', 'message' => 'Only word characters and dashes are allowed.'], [['moduleClass'], 'match', 'pattern' => '/^[\\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'], [['moduleClass'], 'validateModuleClass']]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['db', 'tableName', 'tableIgnore'], 'filter', 'filter' => 'trim'], [['db', 'tableName', 'genmode'], 'required'], ['datalimit', 'default', 'value' => 10], ['genmode', 'default', 'value' => self::MODE_TPL], ['genmode', 'in', 'range' => [self::MODE_TPL, self::MODE_FIXT]], ['datalimit', 'integer', 'min' => 1], [['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'], ['templatePath', 'safe']]);
 }