-
Notifications
You must be signed in to change notification settings - Fork 35
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
Flaw in AbstractConfigProvider
#50
Comments
@robbertstevens thank you for your report ! But as far as we know interceptors are used not in all of cases in Magento. Thanks in advance ! |
We indeed have an plugin on the The solution I gave is really easy to implement and it will make the code much better in general. It will make the code also much easier to extend via plugins because you do not have to do some trickery with making plugins on a magic method. And you do not have to do trickery with annotation to notify the IDE that we have indeed certain methods available. |
it's good to know that we were right in our research according to custom plugin you have solution you gave is easy to implement, but when it's for only one config variable |
You are not repeating anything right? All the methods you will add are different and will return different values. So you will not repeat yourself. |
making of tens similar access methods is possible and much more trivial than existing approach , but existing approach allows us to remains code more compact and easy to change if needed |
@robbertstevens Like my colleague @vladislav-padalka-hys mentioned, we are currently not planning to change this. This piece of code is in here since the start of our plugin. We are always open to new/better changes but for now we see no direct improvement for all of our merchants by changing this. I will put your feedback on our backlog and we will discuss this later this year. If you need some help with your original issue 'buckaroo fee for transactions was not displayed inclusive tax' please let us know. |
I'd like to second the issue. I wrote a plugin for the iDeal config provider to apply a custom sorting on the issuers and then discovered that the module stopped working. I have written a patch (for which I created a pull request in the TIG era) that uses another approach: just strip off the 'Interceptor' part: diff --git a/Model/ConfigProvider/AbstractConfigProvider.php b/Model/ConfigProvider/AbstractConfigProvider.php
index aacc0fea..463c23fd 100644
--- a/Model/ConfigProvider/AbstractConfigProvider.php
+++ b/Model/ConfigProvider/AbstractConfigProvider.php
@@ -120,6 +120,10 @@ public function __call($method, $params)
$class = get_class($this);
$classParts = explode('\\', $class);
$className = end($classParts);
+ if ($className == 'Interceptor') {
+ array_pop($classParts);
+ $className = end($classParts);
+ }
/**
* Uppercase and append it to the XPATH prefix & child class' name You can find the commit here: ecomni/buckaroo-magento2@7ba9c35 I'd be happy to submit a new PR if you want to. |
@markvds Thank you for your comment. Need to Look at the details from @robbertstevens which look valid to me. In the meantime feel free to submit a PR, please branch off develop - Contribution Guidelines |
@robbertstevens |
I'm surprised this issue still has not been solved (1.44). @serpentscode please solve this in the next bugfix release. |
@TerrorSquad we have refactored this issue on another branch Buckaroo v2.0 #246. We are preparing a bigger release with the refactored code, changing the main branch to address this problem is not now our priority, because it will be fixed soon in the new release. |
Hello,
Currently I am investigating an issue we have in one of our shops. The issue is that the buckaroo fee for transactions was not displayed inclusive tax. But I believe the exact issue is not relevant because the cause is much deeper than this.
I have tracked this down to the
AbstractConfigProvider::__call
method. What this method does is dynamically create a string which should be a constant in the class that implementsAbstractConfigProvider
and then pass it into$this->getConfigFromXpath(constant($constant), $store);
This however is not possible, because of Magento creating
Interceptor
classes for all classes, this is to enable the plugin system.The string that is created for example
XPATH_BUCKAROOFEE_PRICE_DISPLAY_CART
should bestatic::XPATH_BUCKAROOFEE_PRICE_DISPLAY_CART
but instead isstatic::XPATH_INTERCEPTOR_PRICE_DISPLAY_CART
This is a fundamental problem with all config providers. My suggestion is get rid of the
AbstractConfigProvider::__call
all together and implement the methods defined above the implementing classes instead of relying on magic.I will solve my issue in a template for now.
The text was updated successfully, but these errors were encountered: