-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
I've run into a specific search edge case where it won't search on nested entities when you search on an entity in 2 different parent entities.
To Reproduce
Have an Entity Foo with something you want to search on, lets call it fooBarBaz.
Then define 2 new entities Bar and Baz that both reference Foo $foo using ManyToOne relations.
Lastly have an entity that contains a ManyToOne reference to both Bar $bar and Baz $baz let's call that BarBaz
Then you configure the search in your your BarBazCrudController like this:
public function configureCrud(Crud $crud): Crud
{
return $crud
->setSearchFields(
[
'bar.foo.fooBarBaz',
'baz.foo.fooBarBaz'
]
);
}In this case you'll only ever get the Bar entities that contain a matching Foo entity, the Baz ones will be omitted.
Looking at the query in the profiler I think it's related to how those are joined.
Which ever entity first joins the Foo entity will get searched, the rest will be skipped.