paolooo / laravel-doctrine

Doctrine 2 for Laravel 5+
MIT License
3 stars 0 forks source link

[Laravel 5.0.27] Bug in Paolooo\LaravelDoctrine\DriverManagerProvider line 45 #3

Closed ntd1712 closed 9 years ago

ntd1712 commented 9 years ago

Currently I modify line 45 to " 'driver' => 'pdo_' . $params['driver'] " to fix the bug.

[2015-04-11 09:35:05] local.ERROR: exception 'Doctrine\DBAL\DBALException' with message 'The given 'driver' mysql is unknown, Doctrine currently supports only the following drivers: pdo_mysql, pdo_sqlite, pdo_pgsql, pdo_oci, oci8, ibm_db2, pdo_sqlsrv, mysqli, drizzle_pdo_mysql, sqlanywhere, sqlsrv' in D:\wamp\www\laravel\backend\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:95 Stack trace:

0 D:\wamp\www\laravel\backend\vendor\doctrine\dbal\lib\Doctrine\DBAL\DriverManager.php(207): Doctrine\DBAL\DBALException::unknownDriver('mysql', Array)

1 D:\wamp\www\laravel\backend\vendor\doctrine\dbal\lib\Doctrine\DBAL\DriverManager.php(153): Doctrine\DBAL\DriverManager::_checkParams(Array)

2 D:\wamp\www\laravel\backend\vendor\paolooo\laravel-doctrine\src\DriverManagerProvider.php(25): Doctrine\DBAL\DriverManager::getConnection(Array)

3 D:\wamp\www\laravel\backend\vendor\paolooo\laravel-doctrine\src\ProxyEntityManager.php(13): Paolooo\LaravelDoctrine\DriverManagerProvider->connection()

4 [internal function]: Paolooo\LaravelDoctrine\ProxyEntityManager->__construct(Object(Paolooo\LaravelDoctrine\EntityManagerProvider))

paolooo commented 9 years ago

Thank you @ntd1712 for raising this one, but I think it's not a good idea, because if you hard code the like driver => 'pro' . $params['driver']you can't use other drivers that doesn't start withpdolikemysql,drizzle_pdo_mysql`, and etc... Also this will violate O in SOLID Principle -

http://www.oodesign.com/open-close-principle.html

ntd1712 commented 9 years ago

Yes, I see. I just want to inform you about the issue :)

paolooo commented 9 years ago

Thanks @ntd1712