My Custom module is working in Magento 2.4.0 but when I installed in Magento 2.4.3 version it’s showing below error in grid section.
Type Error occurred when creating object: RhCategoryGalleryModelResourceModelImagegalleryCollectionInterceptor, Argument 5 passed to RhCategoryGalleryModelResourceModelImagegalleryCollectionInterceptor::__construct() must implement interface MagentoFrameworkDBAdapterAdapterInterface or be null, array given, called in /var/www/html/cwcabinets/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121
Exception in /var/www/html/cwcabinets/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:131
Here is my code
Rh/CategoryGallery/Model/ResourceModel/Imagegallery/Collection.php
<?php
namespace RhCategoryGalleryModelResourceModelImagegallery;
/**
* Class Collection
* @package RhCategoryGalleryModelResourceModelImagegallery
*/
class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
{
/**
* Define resource model
*
* @return void
*/
protected function _construct()
{
$this->_init('RhCategoryGalleryModelImagegallery', 'RhCategoryGalleryModelResourceModelImagegallery');
}
}
app/code/Rh/CategoryGallery/Model/ResourceModel/Imagegallery.php
<?php
namespace RhCategoryGalleryModelResourceModel;
/**
* Class Imagegallery
* @package RhCategoryGalleryModelResourceModel
*/
class Imagegallery extends MagentoFrameworkModelResourceModelDbAbstractDb
{
/**
* Imagegallery constructor.
* @param MagentoFrameworkModelResourceModelDbContext $context
*/
public function __construct(
MagentoFrameworkModelResourceModelDbContext $context
) {
parent::__construct($context);
}
/**
* init category gallory
*/
protected function _construct()
{
$this->_init('categorygallery', 'gallery_id');
}
}
app/code/Rh/CategoryGallery/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="category_image_gallery_listing_data_source" xsi:type="string">RhCategoryGalleryModelResourceModelImagegalleryCollection</item>
</argument>
</arguments>
</type>
<virtualType name="RhCategoryGalleryModelResourceModelImagegalleryCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">categorygallery</argument>
<argument name="resourceModel" xsi:type="string">RhCategoryGalleryModelResourceModelImagegallery</argument>
</arguments>
</virtualType>
<type name="RhCategoryGalleryModelImageUploader">
<arguments>
<argument name="baseTmpPath" xsi:type="string">categoryimagegallery/tmp/</argument>
<argument name="basePath" xsi:type="string">categoryimagegallery/</argument>
<argument name="allowedExtensions" xsi:type="array">
<item name="jpg" xsi:type="string">jpg</item>
<item name="jpeg" xsi:type="string">jpeg</item>
<item name="gif" xsi:type="string">gif</item>
<item name="png" xsi:type="string">png</item>
</argument>
</arguments>
</type>
</config>
Let me know What I need to change for Magento 2.4.3