-
Notifications
You must be signed in to change notification settings - Fork 17
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
Method by name already exists in this class #21
Comments
I'm investigating this issue atm, it looks like it has the problem when plugin names are the exact same but the first letter is in the different casing, so for example in my testing it correctly run when trying to generate it with names: XXX::UpdateElasticQuery But incorrectly when naming is: XXX::UpdateElasticQuery So the issue is somewhere in the casing |
Hi, What is the default magento behaviour in this case? Are both plugins executed or does the later overrides the first one defined? If it is overridden does it also override it if same name is in different case ("foo" and "Foo")? Names of variables and getters for plugins are generated from clean_name field generated in this method: So probably we need to add duplication check here and make this duplication check case insensitive. |
@jambardnishvili , thanks, awesome investigation. |
Testing with default Magento.It seems like both Interceptor's are generated in both cases, triggering wise it does seem to have weird side-effects maybe they are intended though 😆 , for example: Case 1, when names are same but casing differs: If i have two controllers which extend each other for example Index, ExtendIndex. and we have a plugin added with same name for each of them. If i hit the Index endpoint, plugin is triggered only once, but if ExtendIndex is hit, then plugin is triggered twice. Case 2, when names are exactly same with casing as well: plugin in both Index, ExtendIndex controllers are only triggered once Testing with the module.Case 1, When casing is same: Case 2, When casing differs |
I think plugins should be inherited so magento behavior seems correct (ExtendIndex has two plugins and Index only one) when casing is same I assume one plugin overrides the other and only one is called so magento is case sensitive here. So guess we just need a fix for Case 2 (When casing differs). |
We have a third party module, which has the following plugin definition:
As you can see, the plugin name, is the same for both classes.
Now the issue is, that in Magento
2.4.7-p3
, these classes extend from each other:class Magento\Elasticsearch\Elasticsearch5\SearchAdapter\Mapper extends \Magento\Elasticsearch\ElasticAdapter\SearchAdapter\Mapper
As soon as I now run
setup:di:compile
, I get the following error message:When I deactivate this module here and let Magento create the plugins as usual, I don't get any error anymore.
So I think it would be awesome if a way could be found to handle situations like that.
Anyone an idea how to approach that?
The text was updated successfully, but these errors were encountered: