protected function _getResource() { if (is_null($this->childMode)) { return parent::_getResource(); } if (empty($this->_resourceName) && empty($this->_resource)) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('The resource isn\'t set.')); } return $this->_resource ?: \Magento\Framework\App\ObjectManager::getInstance()->get($this->_resourceName)->setChildMode($this->childMode); }