Browse Source

Fixes #1107: Gii CRUD generator now validates same named model and search model class names

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
1c1cd863ca
  1. 1
      framework/yii/gii/generators/crud/Generator.php

1
framework/yii/gii/generators/crud/Generator.php

@ -44,6 +44,7 @@ class Generator extends \yii\gii\Generator
return array_merge(parent::rules(), [
['moduleID, controllerClass, modelClass, searchModelClass, baseControllerClass', 'filter', 'filter' => 'trim'],
['modelClass, searchModelClass, 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' => ActiveRecord::className()]],
['baseControllerClass', 'validateClass', 'params' => ['extends' => Controller::className()]],

Loading…
Cancel
Save