public function boot(Application $app)
 {
     $app->on('kernel.response', function (FilterResponseEvent $event) use($app) {
         if (isset($app['cookie.init'])) {
             foreach ($app['cookie']->getQueuedCookies() as $cookie) {
                 $event->getResponse()->headers->setCookie($cookie);
             }
         }
     });
 }
 public function boot(Application $app)
 {
     $app->on('kernel.terminate', function () use($app) {
         if ($app['mailer.initialized']) {
             try {
                 $app['swift.spooltransport']->getSpool()->flushQueue($app['swift.transport']);
             } catch (\Exception $e) {
             }
         }
     });
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function boot(Application $app)
 {
     $this->registerLanguages($app['translator']);
     $this->registerResources($app['locator']);
     if ($this->getConfig('parameters.settings')) {
         if (is_array($defaults = $this->getConfig('parameters.settings.defaults'))) {
             $this->parameters = array_replace($this->parameters, $defaults);
         }
         if (is_array($settings = $this['option']->get("{$this->name}:settings"))) {
             $this->parameters = array_replace($this->parameters, $settings);
         }
     }
     $app->on('system.site', function () use($app) {
         $this->registerRenderer($app['view.sections'], $app['view']);
     });
     $app->on('system.positions', function ($event) {
         foreach ($this->getConfig('positions', []) as $id => $position) {
             list($name, $description) = array_merge((array) $position, ['']);
             $event->register($id, $name, $description);
         }
     });
 }