Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
15 | class RemoveAliasSubscriber extends BaseSubscriber |
||
16 | { |
||
17 | /** |
||
18 | * @{inheritDoc} |
||
19 | */ |
||
20 | public function getSubscribedEvents() |
||
25 | ); |
||
26 | } |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Schedule an object's alias to be deleted. |
||
31 | * |
||
32 | * @param LifecycleEventArgs $e |
||
33 | * @return void |
||
34 | */ |
||
35 | public function preRemove($e) |
||
36 | { |
||
37 | $entity = $e->getObject(); |
||
38 | |||
39 | if ($entity instanceof $this->className) { |
||
40 | // schedule alias removal (this needs to be done before the entity is removed and loses its id) |
||
41 | $this->container->get($this->aliaserServiceId)->removeAlias($entity, true); |
||
42 | } |
||
43 | } |
||
44 | |||
45 | |||
46 | /** |
||
47 | * Remove the aliases for all removed records. |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | public function postFlush() |
||
54 | } |
||
55 | } |
||
56 |