Playing around with Magento 2 but run into a problem I can not wrap my head around. The object manager tries to instantiate Abstract class, this gives an Fatal Error. Does someone know what might cause this or point me in the right direction?
The Error
Fatal error: Cannot instantiate abstract class Magento\Framework\Model\Resource\AbstractResource in /lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php on line 75
The Problem
My module has a model that extends the \Magento\Quote\Model\Quote
. The constructor of this model has the following line injecting this:
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
.
The controller that is instantiating the model extends the \Magento\Backend\App\Action
and uses $this->_objectManager->create()
to instantiate the model.
The thing I can not wrap my head around is if I instantiate the Magento model it just works but if I instantiate my model it tries to instantiate this abstract class throwing the error above. What tells the object manager to do this and how can I solve my problem?
My first thought was Magento uses the di.xml
to replace this, execute this or something, this was not the case.
Thanks for taking the time to read this. Any help or input on this issue is appreciated.
__construct
method of your model.