| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class VideoRecommendationCacheSubscriber implements EventSubscriber |
||
| 14 | { |
||
| 15 | public function __construct( |
||
| 16 | private readonly VideoRecommendationService $videoRecommendationService |
||
| 17 | ) { |
||
| 18 | } |
||
| 19 | |||
| 20 | public function getSubscribedEvents(): array |
||
| 21 | { |
||
| 22 | return [ |
||
| 23 | Events::postUpdate, |
||
| 24 | Events::postRemove, |
||
| 25 | ]; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function postUpdate(LifecycleEventArgs $args): void |
||
| 29 | { |
||
| 30 | $entity = $args->getObject(); |
||
| 31 | |||
| 32 | if ($entity instanceof Video) { |
||
| 33 | $this->videoRecommendationService->clearVideoRecommendationsCache($entity); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | public function postRemove(LifecycleEventArgs $args): void |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |