Writes: ( ! ) Zend\ServiceManager\Exception\ServiceNotCreatedException: Service with name "doctrine.driver.orm_default" could not be created. Reason: Drivers must specify a class in /var/www/projects/library2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 765 ( ! ) Zend\ServiceManager\Exception\ServiceNotCreatedException: Service with name "doctrine.driver.orm_default" could not be created. Reason: Drivers must specify a class in /var/www/projects/library2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 765 In the file modules.config.php added: 'DoctrineModule', 'DoctrineORMModule',

Contents of doctrine.global.php:

 <?php use Doctrine\DBAL\Driver\PDOPgSql\Driver; return [ 'doctrine' => [ 'connection' => [ 'orm_default' => [ 'driverClass' => Driver::class, 'params' => [ 'host' => 'localhost', 'port' => '5432', 'user' => 'production', 'password' => 'production', 'dbname' => 'library', ] ], ], ], ]; 

    1 answer 1

    Installing Doctrine via composer

     composer require doctrine/doctrine-orm-module composer require doctrine/doctrine-module 

    Next, add DoctrineModule , DoctrineORMModule to the modules.config.php file.

     /** * List of enabled modules for this application. * * This should be an array of module namespaces used in the application. */ return [ // .... 'DoctrineModule', 'DoctrineORMModule', // ..... ]; 

    My working configuration is doctrine.global.php.

     <?php use Doctrine\DBAL\Driver\PDOMySql\Driver as PDOMySqlDriver; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; return [ 'doctrine' => [ 'connection' => [ // настройка соединения с базой данных MySQL 'orm_default' => [ 'driverClass' => PDOMySqlDriver::class, 'params' => [ 'host' => 'localhost', 'port' => '3306', 'user' => '[]', 'password' => '[]', 'dbname' => '[]', 'charset' => 'utf8', 'driverOptions' => [ PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "UTF8"', ], ], ], ], 'driver' => [ 'Doctrine_driver' => [ 'class' => AnnotationDriver::class, 'cache' => 'array', 'paths' => [ __DIR__ . '/../../module/Application/src/Entity', ], ], 'orm_default' => [ 'drivers' => [ 'Application\Entity' => 'Doctrine_driver', ], ], ], ], ]; 

    I hope this helps you.