1

I have Magento enterprise version 2.4.5-p1, I am getting following error in the system.log

Error:- .CRITICAL: Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\AbstractResource in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121

I thought the issue is in this constructor parameter code which I have overridden from default Magento RMA's Model,

public function __construct(
 \Magento\Framework\Model\Context $context,
 \Magento\Framework\Registry $registry,
 \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
 AttributeValueFactory $customAttrFactory,
 \Magento\Store\Model\StoreManagerInterface $storeManager,
 \Magento\Rma\Model\RmaFactory $rmaFactory,
 \Magento\Rma\Model\Config $rmaConfig,
 \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
 \Magento\Framework\Stdlib\DateTime\DateTime $dateTimeDateTime,
 \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
 \Magento\Rma\Helper\Data $rmaHelper,
 TimezoneInterface $localeDate,
 RmaRepositoryInterface $rmaRepoInterface,
 RmaAttributesManagementInterface $metadataService,
 AddressRenderer $addressRenderer,
 RmaEntityFactory $customReturn,
 \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
 \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
 array $data = []
) {
 parent::__construct(
 $context,
 $registry,
 $extensionFactory,
 $customAttrFactory,
 $storeManager,
 $rmaFactory,
 $rmaConfig,
 $transportBuilder,
 $dateTimeDateTime,
 $inlineTranslation,
 $rmaHelper,
 $localeDate,
 $rmaRepoInterface,
 $metadataService,
 $addressRenderer,
 $resource,
 $resourceCollection,
 $data
 );
 $this->storeManager = $storeManager;
 $this->rmaConfig = $rmaConfig;
 $this->transportBuilder = $transportBuilder;
 $this->inlineTranslation = $inlineTranslation;
 $this->rmaHelper = $rmaHelper;
 $this->addressRenderer = $addressRenderer;
 $this->customReturn = $customReturn;
}

Can anyone have idea, where am I doing wrong ?

Thanks in advance

asked May 12, 2023 at 10:20
4
  • run this command and check it resolved or not ? rm -rf generated/* var/cache var/page_cache Commented May 24, 2023 at 11:56
  • Also Need to check all variables passed of the parent class in the construct or not Commented May 24, 2023 at 12:05
  • @CharmiPatel, appreciate your response, I already passed all the parents class parameters in constructor, and also tried running deploy command and tried removing generated and var folder Commented May 24, 2023 at 15:07
  • please replace with the whole file here Commented May 25, 2023 at 4:20

1 Answer 1

0

This happens when any of our custom or third party extension has default parameter in between for __construct() arguments instead of at the end. (Optional parameter should be add at the end in custom extension or third party extension)

Please check which action you're performing while getting this error. One of the classes involved in this action can have a default parameter in between, like below:

enter image description here

Need to move array $data = [] at the last position because it has a default value.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.