浏览文章
文章信息
Installing data... PHP Fatal error: Uncaught Error: Call to a member function get() on null
15296
Installing data... PHP Fatal error: Uncaught Error: Call to a member function get() on null in /www/wwwroot/bbs.aiweline.com/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:160
解释:
检查你的模块下:Setup/InstallData.php代码。
注意:初始化函数__construct()中不要实例化\Magento\Framework\App\ObjectManager,即使成功实例化也将在实例化Factory工厂类时发生错误。
正确使用:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$categoryFactory = $objectManager->get('\Magento\Catalog\Model\CategoryFactory');