I have a model class that I'm trying to inject a ScopeConfigInterface into, and after compiling di, the product grid says "The resource isn't set." My class extends
\Magento\Framework\Model\AbstractModel
and implements \Magento\Framework\DataObject\IdentityInterface
, \myCompany\myModule\Api\Data\MyEntityInterface
.
Errors in var/system.log
:
[2017-03-15 22:36:51] main.CRITICAL: Broken reference: the 'header' tries to reorder itself towards 'global.notices', but their parents are different: 'page.wrapper' and 'notices.wrapper' respectively. [] []
[2017-03-15 22:36:51] main.CRITICAL: Broken reference: the 'page.breadcrumbs' tries to reorder itself towards 'notifications', but their parents are different: 'page.wrapper' and 'notices.wrapper' respectively. [] []
[2017-03-15 22:36:51] main.CRITICAL: Broken reference: the 'global.search' tries to reorder itself towards 'notification.messages', but their parents are different: 'header.inner.right' and 'header' respectively. [] []
[2017-03-15 22:36:51] main.CRITICAL: The resource isn't set. [] []
The only thing I've added to the class is the new __construct()
code. Here is my code.
protected function _construct() {
$this->_init('\myCompany\myModule\Model\ResourceModel\MyEntity');
}
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
$this->_scopeConfig = $scopeConfig;
}
Best Answer
I wasn't in accord with the parent class' constructor. The surprising thing is magento setup:di:compile yielded no error. Anyway, here's the solution.