diff --git a/CHANGELOG.md b/CHANGELOG.md index a58f60a2c..505849d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,7 @@ Yii Framework 2 mongodb extension Change Log 3.0.2 under development ----------------------- -- no changes in this release. - +- Bug #373: Fix generator `trim` validator and `strtolower` causes exception in PHP 8.1 (dorkdomain) 3.0.1 May 22, 2023 ------------------ diff --git a/src/gii/model/Generator.php b/src/gii/model/Generator.php index 164adcd77..71e370e38 100644 --- a/src/gii/model/Generator.php +++ b/src/gii/model/Generator.php @@ -24,10 +24,10 @@ class Generator extends \yii\gii\Generator { public $db = 'mongodb'; public $ns = 'app\models'; - public $collectionName; - public $databaseName; + public $collectionName = ''; + public $databaseName = ''; public $attributeList; - public $modelClass; + public $modelClass = ''; public $baseClass = 'yii\mongodb\ActiveRecord'; @@ -53,7 +53,7 @@ public function getDescription() public function rules() { return array_merge(parent::rules(), [ - [['db', 'ns', 'collectionName', 'databaseName', 'attributeList', 'modelClass', 'baseClass'], 'filter', 'filter' => 'trim'], + [['db', 'ns', 'collectionName', 'databaseName', 'attributeList', 'modelClass', 'baseClass'], 'filter', 'filter' => 'trim', 'skipOnEmpty' => true], [['ns'], 'filter', 'filter' => function($value) { return trim($value, '\\'); }], [['db', 'ns', 'collectionName', 'baseClass'], 'required'],