/**
  * @param SilexApplication $app
  * @return ControllerCollection
  */
 public function connect(SilexApplication $app)
 {
     $this->collection = Application::getControllersFactory();
     $this->collection->setCallbackPrefix($this->controller_id);
     $app[$this->controller_id] = $app->share(function ($app) {
         $class = $this->controller_class;
         return new $class($app);
     });
     $this->configureRoutes($this->collection);
     return $this->collection;
 }
 /**
  * Register and configure the MonologServiceProvider, and log database queries.
  */
 protected function configureLogging()
 {
     parent::configureLogging();
     $logger = new DebugStack();
     $this->getDBConfig()->setSQLLogger($logger);
     $this->after(function () use($logger) {
         foreach ($logger->queries as $query) {
             self::getMonolog()->debug($query["sql"], array("params" => $query["params"], "types" => $query["types"]));
         }
     });
 }