-
Notifications
You must be signed in to change notification settings - Fork 46
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
3.x: add ability to add multiple optional parameters to table scopes #226
Conversation
* @return mixed The modified resource. | ||
*/ | ||
public function applyScope(string $action, mixed $resource): mixed; | ||
public function applyScope(string $action, mixed $resource, mixed ...$optionalArgs): mixed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a breaking change as user-land code will have implemented this interface. We should add this to the documentation/migration guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I was just curious if you guys even like this idea or not 😄
The first version of the 3.0 migration guide has been added with the major changes I have seen via looking at 2.x...3.x-scope-params
'secondArg' => false, | ||
]) | ||
->willReturn($query); | ||
$result = $service->applyScope($user, 'additionalArguments', $query, 'first argument', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these changes also enable the use of named parameters? eg. applyScope($user, category: $category)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a test which proves it works 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
Fixes #225