I have created custom module and it's working fine in Dev, but it's not working on Production. It's throwing Type error.
Type Error occurred when creating object: Tiny\ProductCustomization\Model\ResourceModel\Product\Collection\Interceptor, Argument 5 passed to Tiny\ProductCustomization\Model\ResourceModel\Product\Collection\Interceptor::__construct() must implement interface Magento\Framework\DB\Adapter\AdapterInterface or be null, string given, called in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 [] [] [2021-01-11 10:11:47] report.CRITICAL: Type Error occurred when creating object: Tiny\ProductCustomization\Model\ResourceModel\Product\Collection\Interceptor [] []
My collection file as below
<?php
namespace Tiny\ProductCustomization\Model\ResourceModel\Product;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
class Collection extends AbstractCollection
{
protected $_idFieldName = 'id';
protected function _construct()
{
$this->_init(
'Tiny\ProductCustomization\Model\Product',
'Tiny\ProductCustomization\Model\ResourceModel\Product'
);
parent::_construct();
}
}
and di.xml
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="tiny_grid_data_source" xsi:type="string">Tiny\ProductCustomization\Model\ResourceModel\Product\Collection</item>
</argument>
</arguments>
</type>
<virtualType name="Tiny\ProductCustomization\Model\ResourceModel\Product\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">tiny_pro</argument>
<argument name="resourceModel" xsi:type="string">Tiny\ProductCustomization\Model\ResourceModel\Product</argument>
</arguments>
</virtualType>
Can you please help me on this?
bin/magento setup:upgrade
?di.xml
try changing thexsi:type
toobject
for theresourceModel
argument