/** * Pre remove * * @param GenericEvent $event */ public function checkChannelLink(GenericEvent $event) { $object = $event->getSubject(); if (!$object instanceof CurrencyInterface) { return; } if (!$object->isActivated() && 0 < $this->channelRepository->getChannelCountUsingCurrency($object)) { throw new LinkedChannelException('You cannot disable a currency linked to a channel.'); } }