diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d773f739..0fa9f205e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log 2.2.6 under development ----------------------- -- no changes in this release. +- Bug #511: Fix validation for `messageCategory` in Generator (rob006) 2.2.5 September 04, 2022 @@ -21,7 +21,7 @@ Yii Framework 2 gii extension Change Log - Bug #467: Fix view `generators/crud/default/controller` (WinterSilence, cjrf) - Bug #476: Fix stucking datalist options in form generator (WinterSilence) - Bug #484: Add parent's labels and hints, fix rule for attribute `moduleClass` in module generator (WinterSilence) -- Bug #486: Update `assets/js/bs4-native.min.js` to latest version (WinterSilence) +- Bug #486: Update `assets/js/bs4-native.min.js` to the latest version (WinterSilence) - Bug #488: Fix `ActionColumn::$urlCreator` in index template of CRUD generator (WinterSilence) - Enh #485: Add validation rules for `enableI18N` and `messageCategory` to Generator (WinterSilence) diff --git a/composer.json b/composer.json index a5034ae2c..e92cdc039 100644 --- a/composer.json +++ b/composer.json @@ -60,6 +60,10 @@ "process-timeout": 1800, "fxp-asset": { "enabled": false + }, + "allow-plugins": { + "cweagans/composer-patches": true, + "yiisoft/yii2-composer": true } }, "repositories": [ diff --git a/src/Generator.php b/src/Generator.php index af3468109..1bbec2659 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -399,9 +399,9 @@ public function validateMessageCategory() { if ($this->enableI18N) { if (empty($this->messageCategory)) { - $this->addError('messageCategory', "Message Category cannot be blank."); - } elseif (!preg_match('~^\w+$~', $this->messageCategory)) { - $this->addError('messageCategory', "Message Category is not valid. It should contain only alphanumeric characters and _."); + $this->addError('messageCategory', 'Message Category cannot be blank.'); + } elseif (!preg_match('~^[\w./-]+$~', $this->messageCategory)) { + $this->addError('messageCategory', 'Message Category is not valid. It should contain only alphanumeric characters, ".", "-", "/", and "_".'); } } }