Answer the question
In order to leave comments, you need to log in
Setting up the console in Doctrine, why do I get an error related to the driver?
Written in one file.
Question: Why do I get an error despite the fact that I specified the name of the driver?
<?php
require_once '../../../vendor/autoload.php';
$con_config = require_once './con-config.php';
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
$isDevMode = true;
$path = array("../../models");
$config = Setup::createAnnotationMetadataConfiguration($path, $isDevMode);
$conn = array(
"dbname"=>$con_config["database"],
"user"=>$con_config["username"],
"password"=>$con_config["password"],
"host"=>$con_config["host"],
"driver"=>$con_config["driver"]
);
$entityManager = EntityManager::create($conn, $config);
return ConsoleRunner::createHelperSet($entityManager);
PHP Fatal error: Uncaught Doctrine\DBAL\DBALException:
The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection(). in C:\xampp\htdocs\CouponSystem\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:114
Stack trace:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question