Open qsolutions-pl opened 5 years ago
Hi @qsolutions-pl. Thank you for your report. To help us process this issue please make sure that you provided the following information:
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:
@magento-engcom-team give me $VERSION instance
where $VERSION
is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.
@qsolutions-pl do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @engcom-backlog-nazar. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label G1 Passed
will be added to the issue automatically. Please, edit issue description if needed, until label G1 Passed
appears.
[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add G2 Passed
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Verify that the issue is reproducible on 2.2-develop
branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop
branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label acknowledged
once verification is complete.
[ ] 7. Make sure that automatic system confirms that report is acknowledged.
A little background on why this doesn't work at the moment. The core routers build the action list using \Magento\Framework\Module\Dir\Reader::getActionFiles
source, which loads the available actions by reading files contained in each module's Controller directory.
https://github.com/magento/magento2/blob/5916c5a0c3eb595ace91448c35a170924cd1c4e1/lib/internal/Magento/Framework/Module/Dir/Reader.php#L123-L136
@pmclain right, but I think extending virtual types would be awesome to create extra action to core controllers.
@qsolutions-pl,
create extra action to core controllers
How is that different from URL rewrites?
How is line line in di.xml
easier than an empty controller class in your module? With such change one would have to check not just Controller
folder but also DI configuration to find a corresponding declaration.
Hello @qsolutions-pl
According to the label "Feature Request" this ticket has been moved into "community-features" track
Thank you for collaboration
Was pointed toward this. My two cents:
It's kind of a different concept. VirtualTypes don't normally take effect by the sheer means of existing. You create a VirtualType and then inject it into some other class or list. That makes me hesitate.
I guess the same concept could be extended to work for controllers though. That would just be a bigger change from what exists now.
Which is to say, one could add some ActionsList class argument or something where you could explicitly define additional classes to treat as actions outside of the standard filesystems path. But then you'd have to address the problem of how Magento knows what frontname and controller path to use for each class given. I feel like convention would be a bad way to go there.
Description
Make Magneto 2 even more flexible then it is now :-) We can create virtual types for blocks, models & most of the classes used in the system. I think it would be great if we could use VirtualTypes for Controllers.
Expected behavior
Use a custom class for an action that does not exists in CORE modules simply by adding 1 node in di.xml file
Benefits
We can extend core routers with VirtualTypes. For example: I need to add new action to a CORE controller / route, I can simply do it like this
<virtualType name="Magento\CatalogSearch\Controller\Result\Somerandomaction" type="Qextensions\NoResults\Controller\Mycustomaction" />
Additional information
I hope my description is selfexplanatory