예제 #1
0
파일: CLI.php 프로젝트: nlegoff/Phraseanet
 /**
  * Registers the autoloader and necessary components.
  *
  * @param string      $name        Name for this application.
  * @param string|null $version     Version number for this application.
  * @param string|null $environment The environment.
  */
 public function __construct($name, $version = null, $environment = self::ENV_PROD)
 {
     parent::__construct($environment);
     $app = $this;
     $this['session.test'] = true;
     $this['console'] = $this->share(function () use($name, $version) {
         return new Console\Application($name, $version);
     });
     $this['dispatcher'] = $this->share($this->extend('dispatcher', function (EventDispatcher $dispatcher, Application $app) {
         $dispatcher->addListener('phraseanet.notification.sent', function () use($app) {
             $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']);
         });
         $dispatcher->addSubscriber(new BridgeSubscriber($app));
         return $dispatcher;
     }));
     $this->register(new PluginServiceProvider());
     $this->register(new WebsocketServerServiceProvider());
     $this->register(new ComposerSetupServiceProvider());
     $this->register(new CLIDriversServiceProvider());
     $this->register(new LessBuilderServiceProvider());
     $this->register(new SignalHandlerServiceProvider());
     $this->register(new TaskManagerServiceProvider());
     $this->register(new TranslationExtractorServiceProvider());
     $this->register(new DoctrineMigrationServiceProvider());
     $this->bindRoutes();
     error_reporting(-1);
     ErrorHandler::register();
     PhraseaCLIExceptionHandler::register();
 }