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 validates ActiveQuery class even when the ActiveQuery option is not checked #412

Open
darksnake747 opened this issue Sep 20, 2019 · 2 comments
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug

Comments

@darksnake747
Copy link

I was generating some models for a new project and started out with generating ActiveQuery classes for each. I had defined my own ActiveQuery class extending the yii core ActiveQuery class and placed that class in the ActiveQuery Class textbox on the Gii form under the "Generate ActiveQuery" checkbox/section.

After a handful, I decided to no longer wanted the ActiveQuery classes yet. I unchecked the checkbox and deleted the ones I had already created, including my core. When I tried to generate a model after that, the preview button did nothing. It seemed to be dying silently. Finally, I thought it was maybe that ActiveQuery class field. So I checked the checkbox and that form section was revealed; and sure enough, there was an error message below that textbox saying the class was invalid. The error is correct, but it shouldn't matter if the checkbox is unchecked; the class named there isn't being used.

What steps will reproduce the problem?

  1. Access Gii's Model generator
  2. Fill in table name and class name fields properly
  3. Check the "Generate ActiveQuery" checkbox
  4. Type anything invalid into the ActiveQuery class textbox
  5. Uncheck the "Generate ActiveQuery" checkbox
  6. Click the Preview submit button

What is the expected result?

I should get a "list" of the one model class that should be generated with the option to click the "Generate" submit button to actually create the class file.

What do you get instead?

Nothing "seems" to happen. The form reloads as it was when you submitted it with just the option to click the Preview submit button. However, if you Check the "Generate ActiveQuery" checkbox again, you will see a validation error on the ActiveQuery class field.

Additional info

Q A
Yii version 2.0.26
PHP version 7.3.7
Operating system Windows 10
@samdark samdark transferred this issue from yiisoft/yii2 Sep 20, 2019
@samdark samdark added type:bug Bug status:ready for adoption Feel free to implement this issue. labels Sep 20, 2019
@samdark
Copy link
Member

samdark commented Sep 20, 2019

Sounds like a bug. Do you want to try fixing it?

@darksnake747
Copy link
Author

I certainly can, may be a little until I get the time to give it; but I'd love to take a stab at helping Yii.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants