Skip to content

[5.x]: AuthorGroup entry query behavior different form user query #18551

@white-lukas

Description

@white-lukas

What happened?

Description

When querying for entries with Entry::find()->authorGroup(['not', 'assistant'])->collect();
It still returns entries if the author is in multiple groups (for example 'assistant' and 'user') while I would expect it to filter out the entries if the author is in 1 of those groups, now it only filters out the entries if the author is just in 1 group (the assistant group) (https://craftcms.com/docs/5.x/reference/element-types/entries.html#authorgroup)

This is because of the subquery that always does an exist query (https://github.com/craftcms/cms/blob/5.x/src/elements/db/EntryQuery.php#L931)
While on the User query to logic is reversed and does a not exist query
(https://github.com/craftcms/cms/blob/5.x/src/elements/db/UserQuery.php#L1053)

Craft CMS version

5.8.19

PHP version

8.3

Operating system and version

Ubuntu 24.04

Database type and version

mysql 8.4

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions