mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add LazyLocator
This commit is contained in:
32
lib/Alchemy/Phrasea/Controller/LazyLocator.php
Normal file
32
lib/Alchemy/Phrasea/Controller/LazyLocator.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace Alchemy\Phrasea\Controller;
|
||||
|
||||
class LazyLocator
|
||||
{
|
||||
/** @var \Pimple */
|
||||
private $pimple;
|
||||
private $serviceId;
|
||||
|
||||
/**
|
||||
* @param \Pimple $pimple
|
||||
* @param string $serviceId
|
||||
*/
|
||||
public function __construct(\Pimple $pimple, $serviceId)
|
||||
{
|
||||
$this->pimple = $pimple;
|
||||
$this->serviceId = $serviceId;
|
||||
}
|
||||
|
||||
public function __invoke()
|
||||
{
|
||||
return $this->pimple->offsetGet($this->serviceId);
|
||||
}
|
||||
}
|
@@ -13,10 +13,12 @@ namespace Alchemy\Phrasea\ControllerProvider\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\Admin\CollectionController;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Collection implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
@@ -26,9 +28,7 @@ class Collection implements ControllerProviderInterface, ServiceProviderInterfac
|
||||
{
|
||||
$app['controller.admin.collection'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new CollectionController($app))
|
||||
->setUserQueryFactory(function () use ($app) {
|
||||
return $app['phraseanet.user-query'];
|
||||
})
|
||||
->setUserQueryFactory(new LazyLocator($app, 'phraseanet.user-query'))
|
||||
;
|
||||
});
|
||||
}
|
||||
@@ -40,10 +40,12 @@ class Collection implements ControllerProviderInterface, ServiceProviderInterfac
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $this->createAuthenticatedCollection($app);
|
||||
$firewall = $this->getFirewall($app);
|
||||
|
||||
$controllers->before(function () use ($app) {
|
||||
$app['firewall']->requireAccessToModule('admin')
|
||||
->requireRightOnBase($app['request']->attributes->get('bas_id'), 'canadmin');
|
||||
$controllers->before(function (Request $request) use ($firewall) {
|
||||
$firewall
|
||||
->requireAccessToModule('admin')
|
||||
->requireRightOnBase($request->attributes->get('bas_id'), 'canadmin');
|
||||
});
|
||||
|
||||
$controllers->get('/{bas_id}/', 'controller.admin.collection:getCollection')
|
||||
|
@@ -46,9 +46,10 @@ class ConnectedUsers implements ControllerProviderInterface, ServiceProviderInte
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $this->createAuthenticatedCollection($app);
|
||||
$firewall = $this->getFirewall($app);
|
||||
|
||||
$controllers->before(function () use ($app) {
|
||||
$app['firewall']->requireAccessToModule('Admin');
|
||||
$controllers->before(function () use ($firewall) {
|
||||
$firewall->requireAccessToModule('Admin');
|
||||
});
|
||||
|
||||
$controllers->get('/', 'controller.admin.connected-users:listConnectedUsers')
|
||||
|
@@ -13,6 +13,8 @@ namespace Alchemy\Phrasea\ControllerProvider\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\Admin\DashboardController;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerCollection;
|
||||
use Silex\ControllerProviderInterface;
|
||||
@@ -20,13 +22,14 @@ use Silex\ServiceProviderInterface;
|
||||
|
||||
class Dashboard implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
use ControllerProviderTrait;
|
||||
|
||||
public function register(Application $app)
|
||||
{
|
||||
$app['controller.admin.dashboard'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new DashboardController($app))
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,11 +39,11 @@ class Dashboard implements ControllerProviderInterface, ServiceProviderInterface
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
/** @var ControllerCollection $controllers */
|
||||
$controllers = $app['controllers_factory'];
|
||||
$controllers = $this->createCollection($app);
|
||||
$firewall = $this->getFirewall($app);
|
||||
|
||||
$controllers->before(function () use ($app) {
|
||||
$app['firewall']->requireAdmin();
|
||||
$controllers->before(function () use ($firewall) {
|
||||
$firewall->requireAdmin();
|
||||
});
|
||||
|
||||
$controllers->get('/', 'controller.admin.dashboard:slash')
|
||||
|
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\ControllerProvider\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\Admin\DataboxController;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Alchemy\Phrasea\Security\Firewall;
|
||||
use Silex\Application;
|
||||
@@ -28,9 +29,7 @@ class Databox implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.admin.databox'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new DataboxController($app))
|
||||
->setUserQueryFactory(function () use ($app) {
|
||||
return $app['phraseanet.user-query'];
|
||||
})
|
||||
->setUserQueryFactory(new LazyLocator($app, 'phraseanet.user-query'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Controller\Admin\UserController;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
@@ -25,12 +26,8 @@ class Users implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.admin.users'] = $app->share(function () use ($app) {
|
||||
return (new UserController($app))
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
})
|
||||
->setUserQueryFactory(function () use ($app) {
|
||||
return $app['phraseanet.user-query'];
|
||||
})
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
|
||||
->setUserQueryFactory(new LazyLocator($app, 'phraseanet.user-query'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\ControllerProvider;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\DatafileController;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\ServiceProviderInterface;
|
||||
@@ -25,9 +26,8 @@ class Datafiles implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.datafiles'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new DatafileController($app, $app['phraseanet.appbox'], $app['acl'], $app['authentication']))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['phraseanet.file-serve'];
|
||||
});
|
||||
->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\PermalinkController;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerCollection;
|
||||
@@ -25,9 +26,8 @@ class Permalink implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.permalink'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new PermalinkController($app, $app['phraseanet.appbox'], $app['acl'], $app['authentication']))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['phraseanet.file-serve'];
|
||||
});
|
||||
->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\DoDownloadController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -26,13 +27,10 @@ class DoDownload implements ControllerProviderInterface, ServiceProviderInterfac
|
||||
{
|
||||
$app['controller.prod.do-download'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new DoDownloadController($app))
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['phraseanet.file-serve'];
|
||||
})
|
||||
->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve'))
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setFileSystemLocator(function () use ($app) {
|
||||
return $app['filesystem'];
|
||||
});
|
||||
->setFileSystemLocator(new LazyLocator($app, 'filesystem'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\EditController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -28,9 +29,7 @@ class Edit implements ControllerProviderInterface, ServiceProviderInterface
|
||||
return (new EditController($app))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setSubDefinitionSubstituerLocator(function () use ($app) {
|
||||
return $app['subdef.substituer'];
|
||||
})
|
||||
->setSubDefinitionSubstituerLocator(new LazyLocator($app, 'subdef.substituer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\ExportController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -27,12 +28,8 @@ class Export implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.prod.export'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new ExportController($app))
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setFileSystemLocator(function () use ($app) {
|
||||
return $app['filesystem'];
|
||||
})
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
})
|
||||
->setFileSystemLocator(new LazyLocator($app, 'filesystem'))
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\LazaretController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -27,18 +28,10 @@ class Lazaret implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.prod.lazaret'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new LazaretController($app))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['phraseanet.file-serve'];
|
||||
})
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setFileSystemLocator(function () use ($app) {
|
||||
return $app['filesystem'];
|
||||
})
|
||||
->setSubDefinitionSubstituerLocator(function () use ($app) {
|
||||
return $app['subdef.substituer'];
|
||||
})
|
||||
->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve'))
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
->setFileSystemLocator(new LazyLocator($app, 'filesystem'))
|
||||
->setSubDefinitionSubstituerLocator(new LazyLocator($app, 'subdef.substituer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\OrderController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -27,12 +28,8 @@ class Order implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.prod.order'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new OrderController($app))
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setUserQueryFactory(function () use ($app) {
|
||||
return $app['phraseanet.user-query'];
|
||||
})
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
->setUserQueryFactory(new LazyLocator($app, 'phraseanet.user-query'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\PushController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -28,12 +29,8 @@ class Push implements ControllerProviderInterface, ServiceProviderInterface
|
||||
return (new PushController($app))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setUserQueryFactory(function () use ($app) {
|
||||
return $app['phraseanet.user-query'];
|
||||
})
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
->setUserQueryFactory(new LazyLocator($app, 'phraseanet.user-query'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\QueryController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -26,12 +27,8 @@ class Query implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.prod.query'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new QueryController($app))
|
||||
->setSearchEngineLocator(function () use ($app) {
|
||||
return $app['phraseanet.SE'];
|
||||
})
|
||||
->setSearchEngineLoggerLocator(function () use ($app) {
|
||||
return $app['phraseanet.SE.logger'];
|
||||
})
|
||||
->setSearchEngineLocator(new LazyLocator($app, 'phraseanet.SE'))
|
||||
->setSearchEngineLoggerLocator(new LazyLocator($app, 'phraseanet.SE.logger'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\RecordController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -26,12 +27,8 @@ class Record implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.prod.records'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new RecordController($app))
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setSearchEngineLocator(function () use ($app) {
|
||||
return $app['phraseanet.SE'];
|
||||
})
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
->setSearchEngineLocator(new LazyLocator($app, 'phraseanet.SE'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\StoryController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -27,9 +28,7 @@ class Story implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.prod.story'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new StoryController($app))
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\ToolsController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -27,12 +28,8 @@ class Tools implements ControllerProviderInterface, ServiceProviderInterface
|
||||
$app['controller.prod.tools'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new ToolsController($app))
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setFileSystemLocator(function () use ($app) {
|
||||
return $app['filesystem'];
|
||||
})
|
||||
->setSubDefinitionSubstituerLocator(function () use ($app) {
|
||||
return $app['subdef.substituer'];
|
||||
})
|
||||
->setFileSystemLocator(new LazyLocator($app, 'filesystem'))
|
||||
->setSubDefinitionSubstituerLocator(new LazyLocator($app, 'subdef.substituer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\TooltipController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -26,9 +27,7 @@ class Tooltip implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.prod.tooltip'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new TooltipController($app))
|
||||
->setSearchEngineLocator(function () use ($app) {
|
||||
return $app['phraseanet.SE'];
|
||||
})
|
||||
->setSearchEngineLocator(new LazyLocator($app, 'phraseanet.SE'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Controller\Prod\UploadController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
@@ -26,23 +27,13 @@ class Upload implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
$app['controller.prod.upload'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new UploadController($app))
|
||||
->setBorderManagerLocator(function () use ($app) {
|
||||
return $app['border-manager'];
|
||||
})
|
||||
->setBorderManagerLocator(new LazyLocator($app, 'border-manager'))
|
||||
->setDispatcher($app['dispatcher'])
|
||||
->setDataboxLoggerLocator($app['phraseanet.logger'])
|
||||
->setEntityManagerLocator(function () use ($app) {
|
||||
return $app['orm.em'];
|
||||
})
|
||||
->setFileSystemLocator(function () use ($app) {
|
||||
return $app['filesystem'];
|
||||
})
|
||||
->setTemporaryFileSystemLocator(function () use ($app) {
|
||||
return $app['temporary-filesystem'];
|
||||
})
|
||||
->setSubDefinitionSubstituerLocator(function () use ($app) {
|
||||
return $app['subdef.substituer'];
|
||||
})
|
||||
->setEntityManagerLocator(new LazyLocator($app, 'orm.em'))
|
||||
->setFileSystemLocator(new LazyLocator($app, 'filesystem'))
|
||||
->setTemporaryFileSystemLocator(new LazyLocator($app, 'temporary-filesystem'))
|
||||
->setSubDefinitionSubstituerLocator(new LazyLocator($app, 'subdef.substituer'))
|
||||
;
|
||||
});
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\ControllerProvider\Root;
|
||||
use Alchemy\Geonames\Exception\ExceptionInterface as GeonamesExceptionInterface;
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Application\Helper\NotifierAware;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Alchemy\Phrasea\ControllerProvider\Root\Login;
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
@@ -37,9 +38,7 @@ class Account implements ControllerProviderInterface
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$app['account.controller'] = $this
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'));
|
||||
|
||||
$controllers = $this->createAuthenticatedCollection($app);
|
||||
|
||||
|
@@ -17,6 +17,7 @@ use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
|
||||
use Alchemy\Phrasea\Authentication\Exception\AuthenticationException;
|
||||
use Alchemy\Phrasea\Authentication\Context;
|
||||
use Alchemy\Phrasea\Authentication\Provider\ProviderInterface;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Core\Event\LogoutEvent;
|
||||
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
||||
use Alchemy\Phrasea\Core\Event\PostAuthenticate;
|
||||
@@ -99,9 +100,8 @@ class Login implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$app['login.controller'] = $this
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
|
||||
;
|
||||
|
||||
$controllers->before(function (Request $request) use ($app) {
|
||||
if ($request->getPathInfo() == $app->path('homepage')) {
|
||||
|
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Core\Event\Subscriber;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Application\Helper\NotifierAware;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
@@ -25,9 +26,7 @@ abstract class AbstractNotificationSubscriber implements EventSubscriberInterfac
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
$this->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'));
|
||||
}
|
||||
|
||||
protected function shouldSendNotificationFor(User $user, $type)
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Provider;
|
||||
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\TaskManager\Job\FtpJob;
|
||||
use Alchemy\Phrasea\TaskManager\Job\ArchiveJob;
|
||||
use Alchemy\Phrasea\TaskManager\Job\BridgeJob;
|
||||
@@ -75,9 +76,8 @@ class TasksServiceProvider implements ServiceProviderInterface
|
||||
|
||||
return [
|
||||
(new FtpJob($app['translator'], $app['dispatcher'], $logger))
|
||||
->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
}),
|
||||
->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'))
|
||||
,
|
||||
new ArchiveJob($app['translator'], $app['dispatcher'], $logger),
|
||||
new IndexerJob($app['translator'], $app['dispatcher'], $logger),
|
||||
new BridgeJob($app['translator'], $app['dispatcher'], $logger),
|
||||
|
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Helper\User;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Application\Helper\NotifierAware;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Alchemy\Phrasea\Notification\Mail\MailSuccessEmailUpdate;
|
||||
@@ -38,9 +39,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
||||
public function __construct(Application $app, Request $Request)
|
||||
{
|
||||
parent::__construct($app, $Request);
|
||||
$this->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
$this->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'));
|
||||
|
||||
$this->users = explode(';', $Request->get('users'));
|
||||
|
||||
|
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Helper\User;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Application\Helper\NotifierAware;
|
||||
use Alchemy\Phrasea\Controller\LazyLocator;
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\Helper\Helper;
|
||||
use Alchemy\Phrasea\Notification\Receiver;
|
||||
@@ -38,9 +39,7 @@ class Manage extends Helper
|
||||
{
|
||||
parent::__construct($app, $Request);
|
||||
|
||||
$this->setDelivererLocator(function () use ($app) {
|
||||
return $app['notification.deliverer'];
|
||||
});
|
||||
$this->setDelivererLocator(new LazyLocator($app, 'notification.deliverer'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user