MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/help.cafsindia.com/vendor/uvdesk/extension-framework/Controller/Application.php
<?php

namespace Webkul\UVDesk\ExtensionFrameworkBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Webkul\UVDesk\ExtensionFrameworkBundle\Utils\ApplicationCollection;
use Webkul\UVDesk\ExtensionFrameworkBundle\Application\Routine\ApiRoutine;
use Webkul\UVDesk\ExtensionFrameworkBundle\Application\Routine\RenderDashboardRoutine;

class Application extends AbstractController
{
    public function dashboard($vendor, $package, $qualifiedName, ApplicationCollection $applicationCollection, RenderDashboardRoutine $event)
    {
        $application = $applicationCollection->findApplicationByFullyQualifiedName($vendor, $package, $qualifiedName);

        if (empty($application)) {
            throw new \Exception("No application found with the qualified name of '$qualifiedName' within the '$vendor/$package' namespace.", 404);
        }

        $dispatcher = new EventDispatcher();
        $dispatcher->addSubscriber($application);
        $dispatcher->dispatch($event, $event::getName());

        // Prepare template data
        $templateData = array_merge([
            'dashboard' => [
                'template' => $event->getTemplateReference()
            ],
            'application' => $application
        ], $event->getTemplateData());

        return $this->render('@UVDeskExtensionFramework//applicationDashboard.html.twig', $templateData);
    }

    public function apiEndpointXHR($vendor, $package, $qualifiedName, ApplicationCollection $applicationCollection, ApiRoutine $event)
    {
        $application = $applicationCollection->findApplicationByFullyQualifiedName($vendor, $package, $qualifiedName);

        if (empty($application)) {
            throw new \Exception("No application found with the qualified name of '$qualifiedName' within the '$vendor/$package' namespace.", 404);
        }

        $dispatcher = new EventDispatcher();
        $dispatcher->addSubscriber($application);
        $dispatcher->dispatch($event, $event::getName());

        return new JsonResponse($event->getResponseData(), $event->getResponseCode());
    }
}