Skip to content

Conversation

@AlexanderPoellmann
Copy link
Contributor

Description

The SelectFilter injects an option with the key __empty to the top of the options when hasEmptyOption is enabled (integrating a relationship).

This causes an "Invalid text representation" error, as __empty is an invalid value for columns of type int / bigint ("id" = __empty) on pgsql.

In order to fix this I have added a static method getRelationshipQueryValues, which filters said __empty key from the (state) value string / values array. I've replaced the arrays $state['values'] and $values with this helper method only where a relationship is queried, so custom option arrays remain untouched.

In the apply method I have changed the query to check for an empty value / empty values, so the relationship scope would not be applied, as "id" = "" would result in yet another error.

For convenience I've also introduced a static property carrying the $emptyRelationshipOptionKey (__empty).

Visual changes

There are no visual changes.

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@github-project-automation github-project-automation bot moved this to Todo in Roadmap Jan 4, 2026
@danharrin danharrin added the bug Something isn't working label Jan 4, 2026
@danharrin danharrin added this to the v4 milestone Jan 4, 2026
@danharrin danharrin merged commit d730c4a into filamentphp:4.x Jan 6, 2026
23 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Roadmap Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants