Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casting needed for Finder filter #341

Closed
dereuromark opened this issue Feb 24, 2024 · 0 comments · Fixed by #342
Closed

Casting needed for Finder filter #341

dereuromark opened this issue Feb 24, 2024 · 0 comments · Fixed by #342

Comments

@dereuromark
Copy link
Member

dereuromark commented Feb 24, 2024

Currently it has the options

    'map' => [],
    'options' => [],

But I get

findUser(): Argument #2 ($uid) must be of type int, string given

With URL

/admin/profiles?uid=115

I guess the string '115' is never casted to int, the custom finder however is

public function findUser(SelectQuery $query, int $uid)

Sure, we can workaround it using

public function findUser(SelectQuery $query, int|string $uid)

But it seems a bit less clean than allowing

'cast' => [
    'field_name' => 'int',
],

or alike as additional option to cast the value accordingly before passing it on?

We cannot always control the (finder) code, or signature. Especially for BC reasons if there are types already set.

@dereuromark dereuromark linked a pull request Feb 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant