rougin / combustor

MVC code generator for Codeigniter 3.
https://roug.in/combustor/
MIT License
31 stars 14 forks source link

could not find driver #3

Closed kenjis closed 9 years ago

kenjis commented 9 years ago

How do I configure Doctrine and SQLite?

--- a/application/config/database.php
+++ b/application/config/database.php
@@ -64,11 +64,11 @@ $query_builder = TRUE;

 $db['default'] = array(
    'dsn'   => '',
-   'hostname' => 'localhost',
+ 'hostname' => 'sqlite:' . APPPATH . 'data/sqlite-database.db',
    'username' => '',
    'password' => '',
    'database' => '',
-   'dbdriver' => 'mysqli',
+ 'dbdriver' => 'pdo',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => TRUE,
$ php vendor/bin/combustor create:controller test
could not find driver
rougin commented 9 years ago

Hello! This issue might be because of Describe library. Unfortunately, Describe only supports MySQL driver. I will try to create a new release of Describe during my free time and I will update this issue after. Thanks for this! :+1:

kenjis commented 9 years ago

I can't find the place where outputs could not find driver.

But at least here is a problem: https://github.com/rougin/combustor/blob/master/src/Doctrine/Templates/Library.txt#L41-51 pdo_mysql is hard coded.

I wrote config converter for my own: https://github.com/kenjis/codeigniter-doctrine/blob/master/libraries/Doctrine.php#L76

But CodeIgniter's db config is too flexible, so it is difficult to convert all cases.

rougin commented 9 years ago

I successfully generated some code using your test case above in the Describe library. Unfortunately, I still need to test them though if it works after the generation of the file. I am also finding a hard time in getting their respective foreign keys knowing that SQLite doesn't support them.

Wow. You really did a great job in determining the database connection based on its driver. Nice! :+1: Regarding the hard coded pdo_mysql, thanks for that! I really forgot to change that line. :D

rougin commented 9 years ago

Hello @kenjis, I currently fixed this issue but it is not yet available to be released. It's in dev-master branch.