ticketItemManager = $ticketItemManager; $this->storage = $storage; } /** * @param FormForgeReasonResponseEvent $event */ public function createTicketItem(FormForgeReasonResponseEvent $event){ $reasonResponse = $event->getForgeReasonResponse(); $this->ticketItemManager->create($reasonResponse); } /** * @param TicketLogEvent $event * @return null */ public function createLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $ticketItem->getCustomer()->getId(), null, $user,$action); } /** * @param TicketLogEvent $event * @return null */ public function closeTicketLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user->getId(), null, $user,$action); } /** * @param TicketLogEvent $event * @return null */ public function resolveTicketLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user->getId(), null, $user,$action); } /** * @param TicketLogEvent $event * @return null */ public function changeInterveningLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user, $toUser = $ticketItem->getInterveningUser() ? $ticketItem->getInterveningUser()->getId() : null, $user,$action); } public function removeInterveningLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user, null, $user, $action); } /** * @param TicketLogEvent $event * @return bool */ public function addMessageLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $from = $user->getId(); if (!is_null($ticketItem->getInterveningUser())){ if (($user->getId() == $ticketItem->getInterveningUser()->getId()) || ($user->getId() != $ticketItem->getCustomer()->getId())){ $to = $ticketItem->getCustomer()->getId(); }else{ $to = $ticketItem->getInterveningUser()->getId(); } }elseif ($user->getId() != $ticketItem->getCustomer()->getId()){ $to = $ticketItem->getCustomer()->getId(); }else{ $to = null; } $this->ticketItemManager->addLog($ticketItem, $from, $to, $user, $action); } /** * @param TicketLogEvent $event * @return bool */ public function removeMessageLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $message = $event->getMessageId(); $this->ticketItemManager->addLog($ticketItem, $message, null, $user, $action); } /** * @param TicketLogEvent $event * @return null */ public function changeServiceLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user, $ticketItem->getCompanyServiceIntervene()->getId(), $user, $action); } /** * @param TicketLogEvent $event * @return null */ public function removeServiceLog(TicketLogEvent $event){ $user = $this->storage->getToken()->getUser(); if (!$user instanceof CustomUserInterface) return null; $action = $event->getAction(); $ticketItem = $event->getTicketItem(); $this->ticketItemManager->addLog($ticketItem, $user, null, $user, $action); } }