2

Is it a good practice to give 2 collections or more in my UI Component tag as shown :

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="brand_listing_data_source" xsi:type="string">HBPlus\Brand\Model\ResourceModel\Brand\Grid\Collection</item>
            <item name="group_listing_data_source" xsi:type="string">HBPlus\Brand\Model\ResourceModel\Group\Grid\Collection</item> <!--Can this be given? -->
        </argument> 
    </arguments>
</type>

I had seperated out the collections under the same node as below for which i used to get this error:

Fatal error: Uncaught exception 'Magento\Framework\Exception\LocalizedException' with message 'More than one node matching the query: /config/type[@name='Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory']' in /var/www/html/Namespace/vendor/magento/framework/Config/Dom.php on line 276

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="brand_listing_data_source" xsi:type="string">HM\Brand\Model\ResourceModel\Brand\Grid\Collection</item>
        </argument>
    </arguments>
</type>

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="group_listing_data_source" xsi:type="string">HM\Brand\Model\ResourceModel\Group\Grid\Collection</item>
        </argument>
    </arguments>
</type>
  • 1
    I am not sure about this. You can seperate collection ui. It works without problem. Check your ui listing/form config first – mrtuvn Feb 28 '17 at 8:54
  • Where do i check this form config, and if i follow the 2nd snippet in my answer i get the error as described: More than one node matching the query – Sushivam Feb 28 '17 at 9:00
  • 1
    config locate in module_dir/view/area/ui-component Make sure all xml tags are valid – mrtuvn Feb 28 '17 at 9:15
  • Ok will cross check, as of now have included the collections under the same Ui component tag , thanks for the file path – Sushivam Feb 28 '17 at 9:18

Your Answer

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

Browse other questions tagged or ask your own question.