/**
  * Bootstraps the application.
  *
  * This method is called after all services are registered
  * and should be used for "dynamic" configuration (whenever
  * a service must be requested).
  *
  * @param  Application $app
  * @throws \Symfony\Component\Console\Exception\LogicException
  * @throws \InvalidArgumentException
  */
 public function boot(Application $app)
 {
     parent::boot($app);
     if (isset($app['logger']) && class_exists('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')) {
         $app['doctrine.dbal.logger'] = $app->share(function () use($app) {
             return new DbalLogger($app['logger'], isset($app['stopwatch']) ? $app['stopwatch'] : null);
         });
         $app['doctrine.dbal.logger.profiling'] = $app->share(function () use($app) {
             return new DebugStack();
         });
         $app['doctrine.dbal.logger.chain'] = $app->share($app->extend('doctrine.dbal.logger.chain', function ($chain) use($app) {
             /* @var $chain \Doctrine\DBAL\Logging\LoggerChain */
             $chain->addLogger($app['doctrine.dbal.logger']);
             $chain->addLogger($app['doctrine.dbal.logger.profiling']);
             return $chain;
         }));
     }
     if (isset($app['console'])) {
         // Add data-fixtures command
         $app['console'] = $app->share($app->extend('console', function ($console) use($app) {
             /* @var $console \SilexCMF\Console\Application */
             $console->getHelperSet()->set(new ConnectionHelper($app['db']), 'db');
             $console->addCommands([new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand()]);
             return $console;
         }));
     }
 }
Exemplo n.º 2
0
 public function register(Application $app)
 {
     parent::register($app);
     $app['db.default_options'] += array('wrapperClass' => 'Tabler\\Connection', 'namespace' => '');
 }
Exemplo n.º 3
0
 /**
  * @param Application $app
  */
 public function register(Application $app)
 {
     $app['dbs.options'] = array('db' => array('driver' => 'pdo_mysql', 'dbname' => 'DATABASE_NAME', 'host' => '127.0.0.1', 'user' => 'DATABASE_USER', 'password' => 'DATABASE_PASS', 'charset' => 'utf8'));
     //
     parent::register($app);
 }