Skip to content

Commit

Permalink
Merge pull request #513 from rob006/patch-1
Browse files Browse the repository at this point in the history
Update regexp for `messageCategory` validation
  • Loading branch information
Bizley authored Jan 29, 2023
2 parents 1973f0b + c156f70 commit 59d16e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
"process-timeout": 1800,
"fxp-asset": {
"enabled": false
},
"allow-plugins": {
"cweagans/composer-patches": true,
"yiisoft/yii2-composer": true
}
},
"repositories": [
Expand Down
6 changes: 3 additions & 3 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "_".');
}
}
}
Expand Down

0 comments on commit 59d16e6

Please sign in to comment.