/** * @@param MoveTicketCommand $command * @return void * @throws \RuntimeException if unable to load required ticket */ public function moveTicket(MoveTicketCommand $command) { $ticket = $this->loadTicketById($command->id); $this->ticketHistoryRepository->store(new TicketHistory($ticket->getId(), $ticket->getKey())); $ticket->move($command->branch); $this->ticketRepository->store($ticket); //Remove old key from history to prevent loop redirects if ($oldHistory = $this->ticketHistoryRepository->findOneByTicketKey($ticket->getKey())) { $this->ticketHistoryRepository->remove($oldHistory); } $this->dispatchEvents($ticket); }