1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace SwagTestSkipRebuild; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostActivateEvent; |
6
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostDeactivateEvent; |
7
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPreActivateEvent; |
8
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPreDeactivateEvent; |
9
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @internal |
13
|
|
|
*/ |
14
|
|
|
class SwagTestSkipRebuildSubscriber implements EventSubscriberInterface |
15
|
|
|
{ |
16
|
|
|
public static function getSubscribedEvents(): array |
17
|
|
|
{ |
18
|
|
|
return [ |
19
|
|
|
PluginPreActivateEvent::class => 'preActivate', |
20
|
|
|
PluginPostActivateEvent::class => 'postActivate', |
21
|
|
|
PluginPreDeactivateEvent::class => 'preDeactivate', |
22
|
|
|
PluginPostDeactivateEvent::class => 'postDeactivate', |
23
|
|
|
]; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function preActivate(PluginPreActivateEvent $event): void |
27
|
|
|
{ |
28
|
|
|
$plugin = $event->getContext()->getPlugin(); |
29
|
|
|
if (!($plugin instanceof SwagTestSkipRebuild)) { |
30
|
|
|
return; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
$plugin->preActivateContext = $event->getContext(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function postActivate(PluginPostActivateEvent $event): void |
37
|
|
|
{ |
38
|
|
|
$plugin = $event->getContext()->getPlugin(); |
39
|
|
|
if (!($plugin instanceof SwagTestSkipRebuild)) { |
40
|
|
|
return; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
$plugin->postActivateContext = $event->getContext(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function preDeactivate(PluginPreDeactivateEvent $event): void |
47
|
|
|
{ |
48
|
|
|
$plugin = $event->getContext()->getPlugin(); |
49
|
|
|
if (!($plugin instanceof SwagTestSkipRebuild)) { |
50
|
|
|
return; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$plugin->preDeactivateContext = $event->getContext(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function postDeactivate(PluginPostDeactivateEvent $event): void |
57
|
|
|
{ |
58
|
|
|
$plugin = $event->getContext()->getPlugin(); |
59
|
|
|
if (!($plugin instanceof SwagTestSkipRebuild)) { |
60
|
|
|
return; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
$plugin->postDeactivateContext = $event->getContext(); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|