-
Notifications
You must be signed in to change notification settings - Fork 669
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
feature(web_services): allows calling WS functions with associative array #9406
Conversation
Awesome, this is a feature I'll be using right away. |
I don't see what changed from the original PR :) |
// $this->assertIsA($e, 'APIException'); | ||
// $this->assertIdentical($e->getMessage(), sprintf(elgg_echo('APIException:InvalidParameter'), 'param1', 'test')); | ||
// } | ||
// } |
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.
Why has this been commented?
I'm going to move some of these changes to a 2.0 PR. |
…rray Plugins can expose their methods in a way that invokes callback functions with a single argument that contains an associative array of parameters, rather than each parameter being its own argument. Deprecates verify_parameters() and serialise_parameters() that are no longer in use. Updates unit tests to include new features, as well as fixes some code issues to match test expectations. Removes eval() magic and serialization from web services to allow for a wider range of callables as method callback. Improves handling and validation of parameters.
Please see #9411. If we decide it can be fixed in 2.x we can merge this as is. |
Casting follows 2.0 behavior and adds more thorough tests. Throw InvalidParameterException if non-array passed in. Empty arrays are valid as array input. An explicit "default" key must be given as a default to be used. A falsy default value should not be considered missing. Re-add testVerifyParametersTypeNotSet.
The feature/fix this PR provides churns the code a bunch for BC concerns and I'd rather put a cleaner PR together to avoid accidentally modifying behavior in 2.x. |
We are back to the question if it's worth the effort. You might as well invest that time into a complete rewrite. |
I can give it another few min, worst case I'll just reopen this. |
wasn't one of the arguments for separating the core plugins that we don't have to be too concerned about BC within plugins? We can release a new major semver release of webservices, people who really require the old behavior can just use the old one. Maybe this should/could be a trial run with that. |
(this was replaced by #9418)
Plugins can expose their methods in a way that invokes callback functions with a single argument that contains an associative array of parameters, rather than each parameter being its own argument.
Deprecates verify_parameters() and serialise_parameters() that are no longer in use.
Updates unit tests to include new features, as well as fixes some code issues to match test expectations
Allows all callables as method callback.
(this rebases #8615 and makes it mostly BC with 2.0)