Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Allow filtering on natural keys #303

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pbowyer
Copy link

@pbowyer pbowyer commented Feb 20, 2019

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.

@pbowyer pbowyer marked this pull request as ready for review February 26, 2019 15:08
@pbowyer
Copy link
Author

pbowyer commented Apr 17, 2019

TBH I can't see how to test this, based on the current tests 😕

The bundle assumed surrogate keys, and returned `Type::INTEGER` for all. This change uses class metadata to get the correct type.
@pbowyer
Copy link
Author

pbowyer commented Mar 7, 2022

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.

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

Successfully merging this pull request may close these issues.

1 participant