yii2-mongodb icon indicating copy to clipboard operation
yii2-mongodb copied to clipboard

gii model generator

Open finnan444 opened this issue 6 years ago • 1 comments

What steps will reproduce the problem?

try to generate model via console, for example: php yii gii/mongoDbModel --db="hobTestMongo" --collectionName="updates" --modelClass="DlcUpdates" --color=1 --ns="app\modules\appAdmin\models\mongo" --attributeList="data,minVersion,maxVersion,platform"

What's expected?

As I i explicitly specified modelClass as DLCUpdates, it ignores it

What do you get instead?

The following files will be generated: modules/appAdmin/models/mongo/Updates.php

Additional info

I suppose the reason is core code: $className = $this->generateClassName($collectionName); plus i didn't find usages of this method: public function validateModelClass()

Q A
Yii version 2.0.15.1
Yii MongoDB version 2.1.7
MongoDB server version 3.2.12
PHP version 7.2
Operating system Ubuntu

finnan444 avatar Aug 03 '18 09:08 finnan444

de7468ec65

Solution: yii\mongodb\gii\model\Generator:158 $className = $this->generateClassName($collectionName); replace $className = $this->modelClass ?: $this->generateClassName($collectionName);

Q A
Yii version 2.0.15.1
Yii MongoDB version 2.1.7
MongoDB server version 3.6
PHP version 7.1
Operating system Windows

h0rseduck avatar Jan 19 '19 19:01 h0rseduck