Error 500 Internal Server Error

GET https://roma-bot.skylex.work/support-bot

Exceptions

Class "App\Security\SupportRoles" not found

Exception

Error

  1. public function findSupportStaffOrderById(): array
  2. {
  3. $users = $this->findAll();
  4. $staff = array_values(array_filter(
  5. $users,
  6. static fn (User $u) => \in_array(SupportRoles::STAFF, $u->getRoles(), true)
  7. ));
  8. usort($staff, static fn (User $a, User $b) => ($a->getId() ?? 0) <=> ($b->getId() ?? 0));
  9. return $staff;
  10. }
UserRepository::{closure:App\Repository\UserRepository::findSupportStaffOrderById():39}()
array_filter() in src/Repository/UserRepository.php (line 37)
  1. * @return list<User>
  2. */
  3. public function findSupportStaffOrderById(): array
  4. {
  5. $users = $this->findAll();
  6. $staff = array_values(array_filter(
  7. $users,
  8. static fn (User $u) => \in_array(SupportRoles::STAFF, $u->getRoles(), true)
  9. ));
  10. usort($staff, static fn (User $a, User $b) => ($a->getId() ?? 0) <=> ($b->getId() ?? 0));
UserRepository->findSupportStaffOrderById() in src/Business/Support/TicketAssignmentService.php (line 22)
  1. ) {
  2. }
  3. public function pickNextAssignee(): ?User
  4. {
  5. $staff = $this->userRepository->findSupportStaffOrderById();
  6. if ($staff === []) {
  7. return null;
  8. }
  9. $lastRaw = $this->appSettingRepository->getValue(AppSetting::KEY_LAST_ASSIGNEE_USER_ID);
TicketAssignmentService->pickNextAssignee() in src/Business/Support/SupportTicketService.php (line 29)
  1. $status = $this->ticketStatusRepository->findOneByCode(TicketStatus::CODE_NEW);
  2. if ($status === null) {
  3. throw new \RuntimeException('У базі немає статусу заявки з кодом NEW.');
  4. }
  5. $assignee = $this->ticketAssignmentService->pickNextAssignee();
  6. $ticket = new Ticket();
  7. $ticket->setClient($client);
  8. $ticket->setSubject($subject);
  9. $ticket->setBody($body);
SupportTicketService->createTicketFromBot() in src/Business/ClientCommands/CreateTicketFlowCommand.php (line 173)
  1. ]);
  2. return;
  3. }
  4. $ticket = $this->supportTicketService->createTicketFromBot($client, $subject, $body);
  5. $client->resetBotConversation();
  6. $this->entityManager->flush();
  7. $assignee = $ticket->getAssignee();
  8. $assigneeLabel = $assignee !== null
CreateTicketFlowCommand->handleBody() in src/Business/ClientCommands/CreateTicketFlowCommand.php (line 53)
  1. return new TelegramResponse('CreateTicketFlow subject');
  2. }
  3. if ($state === Client::BOT_STATE_AWAITING_BODY) {
  4. $this->handleBody($request, $client);
  5. return new TelegramResponse('CreateTicketFlow body');
  6. }
  7. return new TelegramResponse('CreateTicketFlow noop');
CreateTicketFlowCommand->execute() in src/Business/Bot/BotHandler.php (line 42)
  1. /** @var CommandInterface $command */
  2. foreach ($this->routes as $command) {
  3. $isApplicable = $command->isApplicable($request);
  4. if ($isApplicable) {
  5. return $command->execute($request);
  6. }
  7. }
  8. return $this->defaultCommand->execute($request);
  9. }
BotHandler->handle() in src/Controller/SupportBotController.php (line 28)
  1. /** @var array<string, mixed> $data */
  2. $data = (array) json_decode($request->getContent(), true);
  3. $tgRequest = (new TelegramRequest())->fromArray($data);
  4. /** @var TelegramResponse $response */
  5. $response = $supportBot->handle($tgRequest);
  6. return new JsonResponse($response->toArray());
  7. }
  8. }
  1. $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
  2. $controller = $event->getController();
  3. $arguments = $event->getArguments();
  4. // call controller
  5. $response = $controller(...$arguments);
  6. // view
  7. if (!$response instanceof Response) {
  8. $event = new ViewEvent($this, $request, $type, $response, $event);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  2. $this->requestStack->push($request);
  3. $response = null;
  4. try {
  5. return $response = $this->handleRaw($request, $type);
  6. } catch (\Throwable $e) {
  7. if ($e instanceof \Error && !$this->handleAllThrowables) {
  8. throw $e;
  9. }
  1. if (!$this->handlingHttpCache) {
  2. $this->resetServices = true;
  3. }
  4. try {
  5. return $this->getHttpKernel()->handle($request, $type, $catch);
  6. } finally {
  7. --$this->requestStackSize;
  8. }
  9. }
  1. ) {
  2. }
  3. public function run(): int
  4. {
  5. $response = $this->kernel->handle($this->request);
  6. if (Kernel::VERSION_ID >= 60400) {
  7. $response->send(false);
  8. if (\function_exists('fastcgi_finish_request') && !$this->debug) {
in vendor/autoload_runtime.php -> run (line 32)
  1. $app = $app(...$args);
  2. exit(
  3. $runtime
  4. ->getRunner($app)
  5. ->run()
  6. );
require_once('/var/www/roma/releases/4/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5. return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Logs

Level Channel Message
INFO 06:07:12 request Matched route "_profiler".
{
    "route": "_profiler",
    "route_parameters": {
        "_route": "_profiler",
        "_controller": "web_profiler.controller.profiler::panelAction",
        "token": "69611e"
    },
    "request_uri": "https://roma-bot.skylex.work/_profiler/69611e?panel=exception&type=request",
    "method": "GET"
}

Stack Trace

Error
Error:
Class "App\Security\SupportRoles" not found

  at src/Repository/UserRepository.php:39
  at App\Repository\UserRepository::{closure:App\Repository\UserRepository::findSupportStaffOrderById():39}()
  at array_filter()
     (src/Repository/UserRepository.php:37)
  at App\Repository\UserRepository->findSupportStaffOrderById()
     (src/Business/Support/TicketAssignmentService.php:22)
  at App\Business\Support\TicketAssignmentService->pickNextAssignee()
     (src/Business/Support/SupportTicketService.php:29)
  at App\Business\Support\SupportTicketService->createTicketFromBot()
     (src/Business/ClientCommands/CreateTicketFlowCommand.php:173)
  at App\Business\ClientCommands\CreateTicketFlowCommand->handleBody()
     (src/Business/ClientCommands/CreateTicketFlowCommand.php:53)
  at App\Business\ClientCommands\CreateTicketFlowCommand->execute()
     (src/Business/Bot/BotHandler.php:42)
  at App\Business\Bot\BotHandler->handle()
     (src/Controller/SupportBotController.php:28)
  at App\Controller\SupportBotController->botAction()
     (vendor/symfony/http-kernel/HttpKernel.php:183)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:193)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:32)
  at require_once('/var/www/roma/releases/4/vendor/autoload_runtime.php')
     (public/index.php:5)