0

I created custom router in custom extension. For eg. : I created 5 custom extension and in all extension there are custom router available.

Now, when i execute url like this : http://127.0.0.1/mg231/en/testing1 It will go for check in all extension's custom router file.

But, this url is for 1st extension.

Is it feasible way?

Should it be working like if executed url is related to 1st extension url then it should be only check in 1st extension's custom router.

1st extension :

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="test1" xsi:type="array">
                    <item name="class" xsi:type="string">Vendor\Module\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">33</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

2nd Extension :

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="test2" xsi:type="array">
                    <item name="class" xsi:type="string">Vendor\Module\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">34</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Please help me.

Any help would be appriciated.

Thanks.

0

You have created multiple extension with customRouter but

        <item name="customrouter" xsi:type="array">

Type will stay remain same means customrouter for all

so it will check all until it get instance of particular router

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.