Skip to content
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

Embedded list shows everything if manytomany is empty #177

Open
DylanKas opened this issue Mar 13, 2020 · 4 comments
Open

Embedded list shows everything if manytomany is empty #177

DylanKas opened this issue Mar 13, 2020 · 4 comments

Comments

@DylanKas
Copy link
Contributor

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 ?

@alterphp
Copy link
Owner

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 ?

@DylanKas
Copy link
Contributor Author

DylanKas commented Mar 16, 2020

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.

@asb1301
Copy link

asb1301 commented Jun 1, 2020

Also encountered this problem. Is a solution planned?

@ici-be
Copy link

ici-be commented Jun 2, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants