Allow filtering on natural keys
Why?
The bundle assumes that relations are surrogate keys, and they are always of Type::INTEGER.
What?
This change uses class metadata to get the correct type for the identifier. Now keys of Type::STRING (and others) will work.
Notes
This is the result of a morning's debugging, working out why specific filters weren't working. It is submitted for discussion and to see if there's a better approach. It's not yet suitable to merge as there are no tests written.
TBH I can't see how to test this, based on the current tests 😕
An update: we've been using this in production for nearly 3 years and it works great.
If readers want to use the branch, update your composer.json to the following:
{
"require": {
"lexik/form-filter-bundle": "dev-natural-keys"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pbowyer/LexikFormFilterBundle"
}
],
}
Preferably fork my repository first, so any changes I make you can review first.