I am trying to run a Console command. I created command which ran successfully, but when I tried to connect to database, it shows an error on Console:
[PDOException] could not find driver
I am using this to get record from database
$conn = $this->getContainer()->get('database_connection');
$sql = "SELECT * FROM tablename WHERE id = 1";
$data = $conn->fetchAssoc($sql);
$output->writeln($data['field_name']);
I am using PostgreSQL with Doctrine DBAL
I am using this command in Windows command line to run the Console command in Symfony:
> php app/console demo:actionfordb
Please guide me what and where I am doing wrong?