Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gii model generator #261

Open
finnan444 opened this issue Aug 3, 2018 · 1 comment
Open

gii model generator #261

finnan444 opened this issue Aug 3, 2018 · 1 comment
Labels
status:to be verified Needs to be reproduced and validated.

Comments

@finnan444
Copy link

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
@cebe cebe added the status:to be verified Needs to be reproduced and validated. label Aug 8, 2018
@h0rseduck
Copy link

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 pushed a commit to h0rseduck/yii2-mongodb that referenced this issue Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests

3 participants