Skip to content

Commit

Permalink
Fix #373: Fix generator trim validator and strtolower causes exce…
Browse files Browse the repository at this point in the history
…ption in PHP 8.1
  • Loading branch information
Dorkdomain authored Jun 12, 2024
1 parent 3648ec5 commit 4e38d85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------
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 4e38d85

Please sign in to comment.