Skip to content

Filters on relation not being applied when entity is being populated #6784

@tar672

Description

@tar672

Describe the bug

Hi
Tricky to describe but I think the repro shows clearly. A global filter where the condition depends on a related entity seems to be ignored when the query uses populate to load the entity with the filter applied.

The issue does NOT appear when doing the exact same query with the "select-in" strategy.

I found #6760 which looks similar however they state that the issues occurs regardless of strategy so I think this must be different.

Happy to try and attempt a fix myself but want to confirm this is a bug first.

Thanks in advance and thanks for Mikro ORM in general - fantastic project.

Reproduction

https://github.com/tar672/mikro-orm-reproduction-filter-report/blob/main/src/example.test.ts

What driver are you using?

None

MikroORM version

6.4.1

Node.js version

20.19.3

Operating system

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions