I am getting this error on my homepage after upgrading my Magento version from 2.4.0 to 2.4.6.
Error: Cannot instantiate abstract class
MagentoFrameworkDataCollectionAbstractResource in
/home/websites/hollywoo/dev/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
Stack trace:
#0 /home/websites/hollywoo/dev/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108):
MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject()
#1 /home/websites/hollywoo/dev/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150):
MagentoFrameworkObjectManagerFactoryCompiled->create()
#2 /home/websites/hollywoo/dev/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): MagentoFrameworkObjectManagerFactoryCompiled->get()
#3 /home/websites/hollywoo/dev/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(56):
MagentoFrameworkObjectManagerFactoryCompiled->create()
#4 /home/websites/hollywoo/dev/public_html/generated/code/Jes/BannerProductSlider/Model/SliderFactory.php(43):
MagentoFrameworkObjectManagerObjectManager->create()
#5 /home/websites/hollywoo/dev/public_html/app/code/Jes/BannerProductSlider/Helper/Data.php(193):
JesBannerProductSliderModelSliderFactory->create()
#6 /home/websites/hollywoo/dev/public_html/app/code/Jes/DynamicPages/Block/Pages/HomePage.php(110):
JesBannerProductSliderHelperData->getActiveSliders()
#7 /home/websites/hollywoo/dev/public_html/app/code/Jes/DynamicPages/view/frontend/templates/bannerslider.phtml(27):
JesDynamicPagesBlockPagesHomePage->getActiveSliders()
I know it is because of the model code. Providing model code of Jes extension
<?php
namespace JesBannerProductSliderModel;
use MagentoFrameworkDataCollectionAbstractDb;
use MagentoFrameworkModelAbstractModel;
use MagentoFrameworkModelContext;
use MagentoFrameworkModelResourceModelAbstractResource;
use MagentoFrameworkRegistry;
use JesBannerProductSliderModelResourceModelBannerCollection;
use JesBannerProductSliderModelResourceModelBannerCollectionFactory;
use MagentoFrameworkAppResourceConnection;
class Slider extends AbstractModel
{
/**
* Cache tag
*
* @var string
*/
const CACHE_TAG = 'jes_bannerproductslider_slider';
/**
* Cache tag
*
* @var string
*/
protected $_cacheTag = 'jes_bannerproductslider_slider';
/**
* Event prefix
*
* @var string
*/
protected $_eventPrefix = 'jes_bannerproductslider_slider';
/**
* Banner Collection
*
* @var Collection
*/
protected $bannerCollection;
/**
* Banner Collection Factory
*
* @var CollectionFactory
*/
protected $bannerCollectionFactory;
protected $_resourceConnection;
/**
* constructor
*
* @param CollectionFactory $bannerCollectionFactory
* @param Context $context
* @param Registry $registry
* @param AbstractResource $resource
* @param AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
CollectionFactory $bannerCollectionFactory,
Context $context,
Registry $registry,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
ResourceConnection $resourceConnection,
array $data = []
) {
$this->bannerCollectionFactory = $bannerCollectionFactory;
$this->_resourceConnection =$resourceConnection;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
/**
* Initialize resource model
*
* @return void
*/
protected function _construct()
{
$this->_init('JesBannerProductSliderModelResourceModelSlider');
}
/**
* Get identities
*
* @return array
*/
public function getIdentities()
{
return [self::CACHE_TAG . '_' . $this->getId()];
}
/**
* get entity default values
*
* @return array
*/
public function getDefaultValues()
{
$values = [];
$values['status'] = '1';
return $values;
}
/**
* @return array|mixed
*/
public function getBannersPosition()
{
if (!$this->getId()) {
return [];
}
$array = $this->getData('banners_position');
if ($array === null) {
$array = $this->getResource()->getBannersPosition($this);
$this->setData('banners_position', $array);
}
return $array;
}
/**
* @return Collection
*/
public function getSelectedBannersCollection()
{
if ($this->bannerCollection === null) {
$collection = $this->bannerCollectionFactory->create();
$collection->getSelect()->join(
['banner_slider' => $this->getResource()->getTable('jes_bannerproductslider_banner_slider')],
'main_table.banner_id=banner_slider.banner_id AND banner_slider.slider_id=' . $this->getId(),
['position']
);
$this->bannerCollection = $collection;
}
return $this->bannerCollection;
}
public function deleteBanners($sliderId)
{
$this->_resourceConnection->getConnection()->delete('jes_bannerproductslider_banner_slider',["slider_id ", $sliderId]);
}
}