-
Notifications
You must be signed in to change notification settings - Fork 638
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
[4.x]: Change in ElementQuery::count effecting EVENT_BEFORE_PREPARE
events
#15001
Comments
I have also noticed that the .count() function does not return the right value for some queries.
This sample code does return the limit of 5 and not the number of the entries. |
Just checked and without the |
@myleshyson, in your case, the @yannkost, in your case, it’s the combination of I raised a draft PR, and we’ll discuss this internally. |
Craft 4.9.5 and 5.1.5 are out with a fix that covers both of these issues. Thanks for reporting! |
This fix seems to have broken proximity searches for both the Google Maps and Maps plugins. I've been digging around through the plugins and Craft itself, but can't figure out exactly:
Do you have any recommendations? |
@lindseydiloreto Can you write into [email protected] with Composer files and a database backup for a site that demonstrates the issue? |
@brandonkelly Certainly, I'll send it over. Thanks! |
We are using Maps plugin in multiple projects and it seems to be broken after both craft 4 and 5 upgrades. |
Craft 4.10.2 and 5.2.2 are out with a fix for Google Maps and Maps. Thanks for reporting @lindseydiloreto! |
Sweet, no problem! Thanks for getting it sorted out so quickly! 🍺 |
What happened?
Description
We noticed that after updating to Craft 4.9, one of our queries wasn't running properly. The logic for this particular query depends on the
EntryQuery::EVENT_BEFORE_PREPARE
event. In particular, in depended on theorderBy
property to be null for for count queries to run properly.Now however, because of this change, the
orderBy
property is not being nulled like it was before withyiii\db\Query::queryScaler
method.I'm not sure if this was on purpose? Either way would it be possible to either:
a) keep the queryScaler logic from
yiii\db\Query::queryScaler
for scalar queries (count, min, max, etc) so that things run like they did before the change ORb) add a property to ElementQuery, something like
queryMethod
, so that events can add that logic back if the query is a scalar query?Craft CMS version
Craft 4.9.0
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: