I'm new to Silex/PHP. I have the following snippet in my index.php.
$app->register(new \Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => $dbConfig
));
dbConfig - is configurable (pdo_sqlite or pdo_mysql). Silex is run under lighttpd with php-fpm.
I have following questions:
- Does Silex create "new" database connection for every request? If so, how does one optimize for performance so old/existing connection is used?
- If new connection is not made, then how can one change the existing connection from one to other for the particular "app" instance when the database configuration changes? In this case, please assume that "app" is the one that process the configuration change and gets to know about it.
Thanks in advance.