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.
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
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 isif (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.