Skip to content

Commit

Permalink
Load catalogue on command execution
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-montanez committed Mar 18, 2016
1 parent 28315e2 commit a70ca72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion EventListener/InitListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\EventDispatcher\Event;

class InitListener
{
Expand All @@ -23,7 +25,7 @@ public function __construct(Loader $loader, EventDispatcherInterface $eventDispa
$translator->addLoader('array', new ArrayLoader());
}

public function onRequest(GetResponseEvent $event)
public function initialize(Event $event)
{
$resourcesEvent = new ResourcesEvent();
$this->eventDispatcher->dispatch(ResourceEvent::EVENT_LOAD, $resourcesEvent);
Expand Down
3 changes: 2 additions & 1 deletion Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ services:
class: Acilia\Bundle\TranslationBundle\EventListener\InitListener
arguments: ["@acilia.translation.loader", "@event_dispatcher", "@translator.default"]
tags:
- { name: kernel.event_listener, event: kernel.request, method: onRequest, priority: 16 }
- { name: kernel.event_listener, event: kernel.request, method: initialize, priority: 16 }
- { name: kernel.event_listener, event: console.command, method: initialize, priority: 16 }

# Translation Loader
acilia.translation.loader:
Expand Down

0 comments on commit a70ca72

Please sign in to comment.