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

Unnecessary mysql queries #15

Open
akorinek opened this issue Jan 20, 2017 · 5 comments
Open

Unnecessary mysql queries #15

akorinek opened this issue Jan 20, 2017 · 5 comments

Comments

@akorinek
Copy link
Contributor

I see lot's of these unnecessary queries in my db log:
SELECT * FROM hazard WHERE 0=1
/home/andreas/labdb/vendor/arogachev/yii2-many-to-many/components/ManyToManyRelation.php:232
/home/andreas/labdb/vendor/arogachev/yii2-many-to-many/components/ManyToManyRelation.php:174
/home/andreas/labdb/vendor/arogachev/yii2-many-to-many/components/ManyToManyRelation.php:169

@arogachev
Copy link
Owner

Could you add related code?

@akorinek
Copy link
Contributor Author

This is in the parent class' behaviour method:

'manytomany' => [
'class' => ManyToManyBehavior::className(),
'relations' => [
[
'name' => 'hazards',
'editableAttribute' => 'editableHazards',
],
],
],

I think the strange query happens when there are no linked child models available.

@csatarij
Copy link

I have the same issue as well.
There are many-many queries like this in the code:
SELECT * FROM [x].[y] WHERE 0=1

the related model's behaviors() is the following:
[
'class' => ManyToManyBehavior::className(),
'relations' => [
[
'name' => 'messageTypes',
'editableAttribute' => 'message_types'
],
[
'name' => 'backendSystems',
'editableAttribute' => 'backend_systems'
],
],
]

@csatarij
Copy link

Any comments?
Should we move to another extension?
There are hundreds of these queries, multiplicated the same ones after each other.

@yepes
Copy link

yepes commented Nov 15, 2019

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants