share(function (PhraseaApplication $app) { return (new DoDownloadController($app)) ->setDelivererLocator(function () use ($app) { return $app['phraseanet.file-serve']; }) ->setDispatcher($app['dispatcher']) ->setFileSystemLocator(function () use ($app) { return $app['filesystem']; }); }); } public function boot(Application $app) { // no-op } /** * {@inheritDoc} */ public function connect(Application $app) { $controllers = $this->createCollection($app); $controllers->get('/{token}/prepare/', 'controller.prod.do-download:prepareDownload') ->before($app['middleware.token.converter']) ->bind('prepare_download') ->assert('token', '[a-zA-Z0-9]{8,32}'); $controllers->match('/{token}/get/', 'controller.prod.do-download:downloadDocuments') ->before($app['middleware.token.converter']) ->bind('document_download') ->assert('token', '[a-zA-Z0-9]{8,32}'); $controllers->post('/{token}/execute/', 'controller.prod.do-download:downloadExecute') ->before($app['middleware.token.converter']) ->bind('execute_download') ->assert('token', '[a-zA-Z0-9]{8,32}'); return $controllers; } }