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

3.x: add ability to add multiple optional parameters to table scopes #226

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

LordSimal
Copy link
Contributor

Fixes #225

@LordSimal LordSimal added this to the 3.0 milestone Jan 6, 2023
src/IdentityDecorator.php Outdated Show resolved Hide resolved
* @return mixed The modified resource.
*/
public function applyScope(string $action, mixed $resource): mixed;
public function applyScope(string $action, mixed $resource, mixed ...$optionalArgs): mixed;
Copy link
Member

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.

Copy link
Contributor Author

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);
Copy link
Member

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)

Copy link
Contributor Author

@LordSimal LordSimal Jan 10, 2023

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 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

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

Successfully merging this pull request may close these issues.

None yet

3 participants