-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Protected getters and setters should be public #10792
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
Protected getters and setters should be public #10792
Conversation
As far as I can see from implementation they are not supposed to be used directly but only via |
Hello @orlangur, |
Necessary product data can be intercepted in |
But how can I retrieve the product if I create a Plugin on the |
For example, such plugin would intercept both |
Oh ok. But do you agree it's not really intuitive and practical to use? :) |
It is quite straightforward if one notice that Are there any other customization problems which cannot be solved in current implementation? |
Another question... Are you trying to customize behavior of some core code or it's a custom implementation? |
It's a custom implementation, it want to calculate the image label with some product information instead of just displaying it. |
In such case you have full control on how and when image helper is called and plugin creation would be a misuse of interception mechanism. Just encapsulate logic in some class so that you do
or even not rely on |
Let's wait for some alternative opinions a bit. I'm pretty sure we should not expose setters but probably public |
Ok so in your opinion, I should not use a plugin here? I thought it was exactly the perfect scenario to use one. |
@VincentMarmiesse yeah, plugin is best suitable when you need to customize some core behavior to your needs. In this case while technically possible it is better to reuse core functionality differently, aggregating image helper in your new class instead of pluginizing it and simply put custom |
@VincentMarmiesse thanks for collaboration! Hope suggested implementation approach will work like a charm for you leaving image helper methods with their current visibility (the stricter = the better). |
Hello,
These getters and setters should be public and not protected function, otherwise we can't access to the class params.