Error configuring Doctrine + Zend

0

Hello,

I'm trying to configure Doctrine ORM to work with the Zend Framework, and when I give the 'bin / doctrine-module' command the following error appears:

            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 the 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'"
                        )
                    )
                )
            )
        )
    );
    
asked by anonymous 04.04.2015 / 22:56

1 answer

1

Missed, in composer.json , put package doctrine/doctrine-orm-module :

"require": {
    "doctrine/doctrine-orm-module": "dev-master",
    "doctrine/doctrine-module": "dev-master",
    "doctrine/data-fixtures": "dev-master"
},

Also, since I believe you will use the packages in your production application (not just in development), I put them in block require of composer.json .

    
04.04.2015 / 23:14