yiisoft / yii2-gii

Yii 2 Gii Extension
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
203 stars 192 forks source link

Gii generates mongo's CRUD error #550

Open Dorkdomain opened 2 weeks ago

Dorkdomain commented 2 weeks ago

What steps will reproduce the problem?

When I use gii to generate curd for mongo models, I get an error Call to undefined method backend\models\data\History::getTableSchema()

What's expected?

Execute correctly

What do you get instead?

Running error

Additional info

Q A
Yii version 2.0.49.4
PHP version 8.3.8
Database version 5.0.6
Operating system mac

In previous versions of gii, this was generated correctly. I compared the error file between the old code and the new code. The error file is yii\gii\generators\crud\Generator, public function getColumnNames()。 In older versions, yiisoft/yii2-gii 2.0.8, the code is if(is_subclass_of($class, 'yii\db\ActiveRecord')) , The new version yiisoft/yii2-gii 2.2.6 , the code is if (is_subclass_of($class, '\yii\db\BaseActiveRecord ')), because mongo models extends from BaseActiveRecord but don't have getTableSchema methods. So the error, I don't know why the new version of the code is written this way, when I change to ActiveRecord, it works.

mtangoo commented 2 weeks ago

Hi, do all other parts work fine?

Dorkdomain commented 2 weeks ago

Hi, do all other parts work fine?

yes