src/Controller/ApiController.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Library\Event\demoSendEvent;
  4. use App\Library\Event\testEvent;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use App\Library\Database;
  8. use App\Library\Grapper;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  13. class ApiController extends AbstractController
  14. {
  15.     public function __construct(private EventDispatcherInterface $dispatcher)
  16.     {
  17.     }
  18.     
  19.     #[Route('/api/demo.{email}.{acid}.{adid}'name'app_demo')]
  20.     public function demoSend(string $emailint $acidint $adid=0):JsonResponse{
  21.         $event = new demoSendEvent($email$acid$adid);
  22.         $this->dispatcher->dispatch($event);
  23.         return $event->getResponse();
  24.     }
  25.     
  26.     #[Route('/api/test.{email}.{acid}'name'app_test')]
  27.     public function testSend(string $emailint $acid):JsonResponse{
  28.         $event = new testEvent($email$acid);
  29.         $this->dispatcher->dispatch($event);
  30.         return $event->getResponse();
  31.     }
  32.     #[Route('/ping'name'ping')]
  33.     public function pingAction():Response
  34.     {
  35.         return new Response('pong');
  36.     }
  37. }