How to use sqlite database on symfony2 project?

前端 未结 5 1251
温柔的废话
温柔的废话 2020-12-29 05:14

In a Symfony2 project, you can configure the databases connections at the app/config/parameters.ini file. Documentation states that you can use, among others, sqlite3 PDO dr

5条回答
  •  悲哀的现实
    2020-12-29 05:42

    I've found that if I add a path line pointing at the database_name to my config.yml, sqlite seems to pick that up, and MySQL doesn't seem to complain.

    doctrine:
        dbal:
            driver:   %database_driver%
            host:     %database_host%
            port:     %database_port%
            dbname:   %database_name%
            path:     %database_name%
            user:     %database_user%
            password: %database_password%
            charset:  UTF8
    

    This means you can still keep all database information in the parameters file, you don't need separate configs depending on which database you are using.

提交回复
热议问题