How do you name the file containing the action controller class so the admin router matches the path to the class?

The module MyCompany_MyModule will add a new page to the admin interface at the URL path admin/mycompany/entity_grid.
How do you name the file containing the action controller class so the admin router matches the path to the class?
A. Controller/Adminhtml/Entity/Grid/Index.php
B. Controller/Adminhtml/Mycompany/Entity/Grid.php
C. Controller/Adminhtml/Entity/Grid.php
D. Controller/Adminhtml/Mycompany/Entity_Grid.php

Download Printable PDF. VALID exam to help you PASS.

6 thoughts on “How do you name the file containing the action controller class so the admin router matches the path to the class?

  1. admin url : /sales/order_invoice/view/invoice_id/1
    this controller have folder structure like Magento\Sales\Controller\Adminhtml\Order\Invoice\View
    and there is invoice_id as param

    so my answer here is A with above explaination

  2. Answer:- A

    My company is a routes name so not included in the controller folder
    entity and grid is the folder name
    and here not defined action name so index.php is Action

  3. Correct Answer A.
    **I have tested.**

    routes.xml : app/code/MyCompany/MyModule/etc/adminhtml/routes.xml

    Controller : app/code/MyCompany/MyModule/Controller/Adminhtml/Entity/Grid/Index.php
    Layout : app/code/MyCompany/MyModule/view/adminhtml/layout/company_entity_grid_index.xml

  4. A answer is correct here

    URL will end up like this admin/mycompany/entity_grid/index

    mycompany is frontName from routes.xml. Doesn’t exist in path

    entity_grid is catalog name will lead to entity/grid

    then Index.php is our file

    Controller/Adminhtml/Entity/Grid/Index.php

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.