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

Update reference-classmethod.txt #2094

Closed
wants to merge 1 commit into from
Closed

Update reference-classmethod.txt #2094

wants to merge 1 commit into from

Conversation

nilsmielke
Copy link
Contributor

The syntax $results = $page->search('my awesome search', 'title|text'); throws the error Kirby\Cms\Page::search(): Argument #2 ($params) must be of type array, string given, called in {…} . Needs to be $results = $page->search('my awesome search', [ 'fields => [ 'title', 'text' ]]); to succeed.

This is in Kirby 4.0.0-beta.1

The syntax `$results = $page->search('my awesome search', 'title|text');` throws the error `Kirby\Cms\Page::search(): Argument #2 ($params) must be of type array, string given, called in {…}` .
Needs to be `$results = $page->search('my awesome search', [ 'fields => [ 'title', 'text' ]]);` to succeed.

This is in Kirby 4.0.0-beta.1
@distantnative
Copy link
Member

@nilsmielke Isn't this than rather a bug in v4?

We also shouldn't make v4 changes to the docs before v4 has been released.

@nilsmielke
Copy link
Contributor Author

@distantnative Probably true. Unfortunately I do not have search set up in a k3 site right now.
Is this rather an issue to be reported in the dicord v4 channel, then?

lukasbestle added a commit to getkirby/kirby that referenced this pull request Sep 22, 2023
getkirby/getkirby.com#2094

`$collection->search()` already supports it, looks like we forgot to update this type hint when we switched from the type comment to the PHP type.
@lukasbestle
Copy link
Member

It's indeed a regression in v4. I've opened a core PR here: getkirby/kirby#5675

@nilsmielke
Copy link
Contributor Author

Thank you, @lukasbestle.

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

Successfully merging this pull request may close these issues.

3 participants