I just try symfony 3 and I am on insert data into database using Doctrine ORM. When I try to run my query
$customer = new Customer(); $customer->setAddress('Some Address'); $customer->setName('Customer 1'); $order->setQuantity('100'); $order->setDate(date('Y-m-d')); $order->setCustomer($customer); $em = $this->getDoctrine()->getManager(); $em->persist($customer); $em->persist($order); $em->flush(); but it returns an exception :
Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: could not find driver" at /home/hei/Sites/practice/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 121 Parameters.yml:
parameters: database_host: 127.0.0.1 database_port: null database_name: practice database_user: root database_password: null Config.yml
doctrine: dbal: driver: pdo_mysql host: '%database_host%' port: '%database_port%' dbname: '%database_name%' user: '%database_user%' password: '%database_password%' I also check if the extension is enabled and loaded via php -m and phpinfo(). It says that PDO & PDO_Mysql is enabled.
Then add these two lines in php.ini:
extension=pdo.so extension=pdo_mysql.so but I still got the same PDO Exception.
My OS is Ubuntu 17.1
<?php phpinfo();and check if mysql extensions is available there