Пример #1
0
 /**
  * Boots the Bundle.
  */
 public function boot()
 {
     if ($this->container->has('error_handler')) {
         $this->container->get('error_handler');
     }
     FormConfiguration::clearDefaultCsrfSecrets();
     if ($this->container->hasParameter('csrf_secret')) {
         FormConfiguration::addDefaultCsrfSecret($this->container->getParameter('csrf_secret'));
         FormConfiguration::enableDefaultCsrfProtection();
     }
     $container = $this->container;
     // the session ID should always be included in the CSRF token, even
     // if default CSRF protection is not enabled
     FormConfiguration::addDefaultCsrfSecret(function () use($container) {
         // automatically starts the session when the CSRF token is
         // generated
         $container->get('session')->start();
         return $container->get('session')->getId();
     });
 }