Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Filter by entity with string id #362

Open
vlastv opened this issue Apr 12, 2022 · 3 comments
Open

Filter by entity with string id #362

vlastv opened this issue Apr 12, 2022 · 3 comments

Comments

@vlastv
Copy link

vlastv commented Apr 12, 2022

Error in https://github.com/lexik/LexikFormFilterBundle/blob/master/Event/Subscriber/DoctrineORMSubscriber.php#L111

@gilles-g
Copy link
Member

?

@vlastv
Copy link
Author

vlastv commented Apr 12, 2022

DoctrineORMSubscriber builds the condition assuming that the primary key is always a integer. But it's not. When the primary key is a string, the filter specifies the type, just like a integer. The code that does this is listed at the beginning.

@spackmat
Copy link
Contributor

spackmat commented Feb 1, 2023

A quick solution, as for many other problems with the EntityFilterType, could be to use the ChoiceFilterType instead with a its choices loaded by a Repository method of the Entity in question and maybe also a n additional "none" choice like I described in #293 . But I also see the problem with the fixed INTEGER-type in DoctrineORMSubscriber, that makes the EntityFilterType incompatible with Uuid and other non-integer primary keys.

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

No branches or pull requests

3 participants