0
Hello,
I am trying to configure Doctrine ORM to work with Zend Framework, and when I give the command 'bin/Doctrine-module' appears the following error:
PHP Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (DoctrineORMModule) could not be initialized.' in /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:195
Stack trace:
#0 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(169): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(96): Zend\ModuleManager\ModuleManager->loadModule('DoctrineORMModu...')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManage in /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php on line 195
Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (DoctrineORMModule) could not be initialized.' in /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:195
Stack trace:
#0 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(169): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(96): Zend\ModuleManager\ModuleManager->loadModule('DoctrineORMModu...')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManage in /var/www/html/zf2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php on line 195
I downloaded the modules through Composer, follow the file:
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "~2.3"
},
"minimum-stability" : "dev",
"require-dev" : {
"doctrine/doctrine-module": "dev-master",
"doctrine/data-fixtures": "dev-master"
},
"config" : {
"bin-dir" : "bin"
}
}
And the autoload configuration is as follows:
<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMysql\Driver',
'params' => array(
'host' => 'localhost',
'port' => '3306',
'user' => 'root',
'password' => '',
'dbname' => 'zf2',
'driverOptions' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
)
)
)
)
)
);
Take a look at this blog http://requirecode.blogspot.com.br/2016/06/instalar-o-doctrine-2-no-zend-framework.html. you’ll find what you need about zf2 and Doctrine 2
– Luciano Schultz