-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Improve examples in parent services #3743
Conversation
will be called twice, resulting in the ``$filters`` array containing both | ||
``my_filter`` and ``another_filter`` objects. This is great if you just want | ||
to add additional filters to the subclasses. If you want to replace the filters | ||
passed to the subclass, removing the parent setting from the config will | ||
prevent the base class from calling ``setFilter``. | ||
prevent the base class from calling ``addFilter``. |
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 whole section seems kind of useless to me and can be simplified to a small note imo.
What this section (line 402 - 512) says is: Both methods from parent and child services are called, you can't override parent method calls. If you don't want the parent method calls, don't extend from parent.
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 completely agree - let's remove it and explain that in just a few short sentences.
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.
made the changes :)
.. tip:: | ||
|
||
In the examples shown, the classes sharing the same configuration also extend | ||
from the same parent in PHP. This does not need to be the case though, you can |
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.
[...] from the same parent class in PHP.
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 isn't necessary at all. You can just extract common parts of similar service definitions [...]
This is much much better - I agree it was kinda crazy before. @xabbuh, you had one more suggestion, which was minor, but was a slight improvement. Definitely make a PR for this :). Thanks guys! |
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #3743). Discussion ---------- Improve examples in parent services The code examples were not readable. That isn't a good thing for the documentation :) | Q | A | --- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - Commits ------- 0535e18 Reworded article a bit a54ffed Made code readable
@weaverryan There you go: #3793 |
The code examples were not readable. That isn't a good thing for the documentation :)