lexik / LexikFormFilterBundle

This Symfony bundle aim to provide classes to build some form filters and then build a doctrine query from this form filter.
MIT License
389 stars 119 forks source link

Filter by entity with string id #362

Open vlastv opened 2 years ago

vlastv commented 2 years ago

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

gilles-g commented 2 years ago

?

vlastv commented 2 years ago

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 commented 1 year ago

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.