Skip to content

Commit

Permalink
Use Core Hook Dispatcher in ModuleZipManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelandrieu committed Aug 17, 2018
1 parent 64bff5c commit b725452
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Adapter/Module/ModuleZipManager.php
Expand Up @@ -27,7 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Module;

use PrestaShopBundle\Event\ModuleZipManagementEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Translation\TranslatorInterface;
Expand Down Expand Up @@ -61,19 +61,19 @@ class ModuleZipManager
private $translator;

/**
* @var EventDispatcherInterface
* @var HookDispatcherInterface
*/
private $dispatcher;
private $hookDispatcher;

public function __construct(
Filesystem $filesystem,
TranslatorInterface $translator,
EventDispatcherInterface $dispatcher
HookDispatcherInterface $hookDispatcher
)
{
$this->filesystem = $filesystem;
$this->translator = $translator;
$this->dispatcher = $dispatcher;
$this->hookDispatcher = $hookDispatcher;
}

/**
Expand Down Expand Up @@ -168,9 +168,14 @@ public function storeInModulesFolder($source)
null,
array('override' => true)
);
$this->dispatcher->dispatch(
ModuleZipManagementEvent::DOWNLOAD,
new ModuleZipManagementEvent($this->getSource($source)));
$this->hookDispatcher
->dispatchWithParameters(ModuleZipManagementEvent::DOWNLOAD,
[
'event' => new ModuleZipManagementEvent($this->getSource($source))
]
)
;

$this->filesystem->remove($sandboxPath);
}

Expand Down

0 comments on commit b725452

Please sign in to comment.