Browse Source

Added PDO persistent connections to silex-orm

Patrick Falls 12 years ago
parent
commit
0f314fbd8a
1 changed files with 6 additions and 6 deletions
  1. 6 6
      php-silex-orm/web/index.php

+ 6 - 6
php-silex-orm/web/index.php

@@ -14,13 +14,13 @@ $loader = require_once __DIR__.'/../vendor/autoload.php';
 
 
 $app = new Silex\Application();
 $app = new Silex\Application();
 
 
-$app->register(new DoctrineServiceProvider(), array(
+$dbh = new PDO('mysql:host=192.168.100.102;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+    PDO::ATTR_PERSISTENT => true
+));
+
+$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
     'db.options' => array(
     'db.options' => array(
-        'driver' => 'pdo_mysql',
-        'host' => '192.168.100.102',
-        'dbname' => 'hello_world',
-        'user' => 'benchmarkdbuser',
-        'password' => 'benchmarkdbpass',
+    'pdo' => $dbh
     ),
     ),
 ));
 ));