-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
AppFramework add default values (ApiController) as parameters #509
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
Conversation
|
@rullzer, thanks for your PR! By analyzing the annotation information on this pull request, we identified @BernhardPosselt, @Xenopathic and @DeepDiver1975 to be potential reviewers |
|
https://github.com/nextcloud/server/pull/509/files?w=1 for easier review 😉 |
| $parameters[] = $this->query($resolveName); | ||
| try { | ||
| $parameters[] = $this->query($resolveName); | ||
| continue; |
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 not simply put the next try catch into the catch block? continue is super confusing here
|
Actually unsure if this is a good idea since adding default parameters will make the container always ignore them. I'd probably make the parent constructor protected since the class is abstract anyways, that would require you to call the parent method and prevent these mistakes. Unfortunately there's no operator overloading in PHP. Another approach would be to also define these defaults in the container so it actually works |
Oeee I like that.... |
We can't really do that. because if we want to make the OCSControllers constructor protected we have to make the APIControllers constructor private and then would mean making the Controllers constrcutor private. |
a787fc7 to
1b73a63
Compare
|
@BernhardPosselt this looks cleaner indeed |
Not really, you can make protected methods public on extends: https://3v4l.org/NL1gv |
|
@nickvergessen yes but it is the other way around https://3v4l.org/qHXuO |
|
@rullzer Could you explain what this does and how to verify it works? |
|
|
👍 |
1 similar comment
|
👍 |
This means that a controller inherriting from the ApiController and not
implementing their own constructor would fail.
Found this while helping @schiessle debug.
CC: @BernhardPosselt @nickvergessen @MorrisJobke @LukasReschke