1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-20 15:53:14 +02:00

[feature/controller] Don't use $user->lang() before container compilation

PHPBB3-10864
This commit is contained in:
David King 2012-11-18 15:51:05 -05:00
parent 50a96a2a2d
commit 60c0a1dd2a
2 changed files with 3 additions and 9 deletions

View File

@ -29,7 +29,6 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('dispatcher');
$user = $container->get('user');
foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events)
{
@ -39,12 +38,12 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface
if (!isset($event['event']))
{
throw new InvalidArgumentException($user->lang('NO_EVENT_ATTRIBUTE', $id));
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
}
if (!isset($event['method']))
{
throw new InvalidArgumentException($user->lang('NO_METHOD_ATTRIBUTE', $id));
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id));
}
$definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));
@ -60,7 +59,7 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
if (!$refClass->implementsInterface($interface))
{
throw new InvalidArgumentException($user->lang('SUBSCRIBER_WRONG_TYPE', $id, $interface));
throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface));
}
$definition->addMethodCall('addSubscriberService', array($id, $class));

View File

@ -47,11 +47,6 @@ $lang = array_merge($lang, array(
'CONTROLLER_SERVICE_UNDEFINED' => 'The service for controller "<strong>%s</strong>" is not defined in ./config/services.yml.',
'CONTROLLER_RETURN_TYPE_INVALID' => 'The controller object <strong>%s</strong> must return a Symfony\Component\HttpFoundation\Response object.',
// Event Listener/Subscriber error messages
'NO_EVENT_ATTRIBUTE' => 'Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.',
'NO_METHOD_ATTRIBUTE' => 'Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.',
'SUBSCRIBER_WRONG_TYPE' => 'Service "%1$s" must implement interface "%2$s".',
// Core error controller messages
'PAGE_NOT_FOUND_ERROR' => 'The page you have requested does not exist.',
'NOT_AUTHORISED_ERROR' => 'You do not have permission to access this page.',