Skip to content

Commit

Permalink
fix #373: fix generator trim and strtolower causes exception in PHP8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
liyu authored and liyu committed Jun 12, 2024
1 parent 3648ec5 commit ec9ec52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Yii Framework 2 mongodb extension Change Log
-----------------------

- no changes in this release.

- Bug #373: fix generator trim validator and strtolower causes exception in PHP8.1 (dorkdomain)

3.0.1 May 22, 2023
------------------
Expand Down
8 changes: 4 additions & 4 deletions src/gii/model/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';


Expand All @@ -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'],
Expand Down

0 comments on commit ec9ec52

Please sign in to comment.