EasyAdminExtensionBundle icon indicating copy to clipboard operation
EasyAdminExtensionBundle copied to clipboard

Embedded list shows everything if manytomany is empty

Open DylanKas opened this issue 4 years ago • 4 comments

Hi,

I have an issue with my embedded list which is between my classes Intern & Internships which is a ManyToMany relationship.

When an internship has at least one intern, it works fine and we can see it in the embedded list. However, if my internship has no interns my embedded list shows every intern in my database.

I tried to debug it by looking into the embeddedListAction and I do not know if this is supposed to happen.

When looking at the $paginator variable in embeddedListAction I can see that when I have atleast one intern the query is :

"SELECT entity FROM App\Entity\Intern entity LEFT JOIN entity.person person WHERE entity.id IN (:form_filter_entity_id) ORDER BY entity.id DESC"

But if there are no intern in my internship the query changes to :

"SELECT entity FROM App\Entity\Intern entity ORDER BY entity.id DESC"

Is that an issue with my configuration or does embeddedListAction not support ManyToMany completely ?

DylanKas avatar Mar 13 '20 13:03 DylanKas

Hi @DylanKas,

I understand why the WHERE has disappeared, this is limitation of IN operator in query builder. But I don't understand why the LEFT JOIN part is removed too. Did you override something about the list query builder ?

alterphp avatar Mar 14 '20 10:03 alterphp

No, there shouldn't be any kind of override on this query. That's why i'm kinda surprised it does that. I also tried to add an ext_filters: {'entity.internships': 'form:parent.data.id'} but that doesn't seems to work at all. It does not use it.

DylanKas avatar Mar 16 '20 07:03 DylanKas

Also encountered this problem. Is a solution planned?

asb1301 avatar Jun 01 '20 08:06 asb1301

Same problem for me... This Bundle is amazing, but this is annoying :)

ici-be avatar Jun 02 '20 13:06 ici-be