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
Creating a preference for category product indexer breaks setup:di:compile #22769
Comments
Hi @mbijnsdorp. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @mbijnsdorp do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @mbijnsdorp, how is that different from #11905? |
Hi @orlangur, that issue only mentions Magento's code generation not being able to process
|
Hi @davidverholen. Thank you for working on this issue.
|
✅ Confirmed by @davidverholen Issue Available: @davidverholen, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
@davidverholen as mentioned in #22826 you can test something like this to fix this issue:
|
Hi @dcabrejas. Thank you for working on this issue.
|
…or when a preference is defined. Fixes magento#22769
Hi @mbijnsdorp. Thank you for your report. The fix will be available with the upcoming 2.3.4 release. |
Could this really be considered as a fix to the reported issue as it just removed the appearance of the issue where it's still possible to create the same issue whilst using totally valid PHP feature? :/ This way, it's pretty easy to get back to a point where one has to revisit the same issue again in the future unless you ban the usage of 'self' within the code by throwing a meaningful exception (actual change to generator to respect 'self' would be better of course). Kind of a "door hinge was squeaking, so we removed the door" situation :( I'd humbly suggest this to be revisited with solution that would be along the lines of what @fsw suggested in his comment. |
@allanpaiste Yes, as I said on my PR, this is more of a patch, it fixes the problem. The real issue is still there but the solution is more complicated. That I leave to Magento Team o another contributor who has the time. |
@dcabrejas I totally dig the approach of getting the local appearance of the issue quickly dealt with! I was just surprised that the ticket was closed and issue declared as solved. Created new report that is written in a way that does not allow a "solved" declaration due to not being based on anything that appears in the code but rather on the idea that one can create such a situation by using valid PHP features. |
It was suggested to me by a member of the Magento community engineering team at Meet Magento UK 2019 that's why it got merged. I would argue that merging a patch now solves this issue for a lot of people, which it does. Fixing the issue properly and applying a patch are not contradictory things. They can coexist since both add value. But I have got no horse on this race so I digress. I hope you guys fix the issue though :) |
@dcabrejas I'm 100% on board with what you are saying :) Maybe the new report gets tagged as "wontfix", just wanted to make sure that it's still considered as something that is contained as a problem in the distributed code (as: php feature not used), but that it remains as something that is still perceived as work in progress and as know/open issue :) |
Summary
When you create a preference for the category product indexer, code compilation breaks. This is because of the definition of the category product indexer execute method: https://github.com/magento/magento2/blob/2.3.1/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php#L155:
Due to the preference, the generated interceptor (Magento already has a plugin defined for the execute method), returns the preferenced class instead of the the Magento indexer, which then doesn't match
: self
.Preconditions (*)
Steps to reproduce (*)
bin/magento setup:di:compile
Expected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: