public function validateParentNotEmpty(ResourceEvent $event) { $group = $event->getSubject(); if ($group->getParent() == null && !$this->context->isGranted(User::ROLE_SUPER_ADMIN)) { $event->stop('dedipanel.group.need_parent'); } }
public function deleteKeyPair(ResourceEvent $event) { try { $this->helper->deleteKeyPair($event->getSubject()); } catch (ConnectionErrorException $e) { $event->stop('cant_delete_public_key', ResourceEvent::TYPE_WARNING); } }
public function preUpdateTeamspeakInstance(ResourceEvent $event) { $entity = $event->getSubject(); try { $entity->getQuery()->updateInstanceConfig($entity); } catch (MaxSlotsLimitReachedException $e) { $event->stop('dedipanel.voip.max_slots'); } }