Skip to content

After upgrade magento 2.4.1 to 2.4.7 an error in the admin grid view of my custom module appears

After upgrade magento 2.4.1 to 2.4.7 an error in the admin grid view of my custom module appears.

ModelResourceModelGridCollectionInterceptor::__construct(): Argument #5 ($connection) must be of type ?MagentoFrameworkDBAdapterAdapterInterface, string given,

my collection.php

namespace MymoduleOrderFeeModelResourceModelGrid;


use MagentoFrameworkModelResourceModelDbCollectionAbstractCollection;

class Collection extends AbstractCollection
{
    protected $_idFieldName = 'id';

   
    protected function _construct()
    {
     
        $this->_init(
        'MymoduleOrderFeeModelGrid',
        'MymoduleOrderFeeModelResourceModelGrid'
    );
    }
    
}

and my di.xml

<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
  <arguments>
   <argument name="collections" xsi:type="array">
     <item name="orderfee_grid_listing_data_source" xsi:type="string">MymoduleOrderFeeGridCollection</item>
   </argument>
  </arguments>
 </type>
 <virtualType name="MymoduleOrderFeeGridCollection" type="MymoduleOrderFeeModelResourceModelGridCollection">
   <arguments>
     <argument name="mainTable" xsi:type="string">mymodule_orderfee</argument>
     <argument name="resourceModel" xsi:type="string">MymoduleOrderFeeModelResourceModelGridCollection</argument>
   </arguments>
 </virtualType>

 <virtualType name="MymoduleOrderFeeModelResourceModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">mymodule_orderfee</argument>
            <argument name="resourceModel" xsi:type="string">MymoduleOrderFeeModelResourceModelGrid</argument>
        </arguments>
    </virtualType>
  <type name="MagentoSalesApiOrderRepositoryInterface">
        <plugin name="mymodule_orderfee_add_order_extension_fee"
          type="MymoduleOrderFeePluginOrderRepositoryPlugin" />
    </type>

Any suggestions are more than welcome.