checkAppEventIsExist example

 {
    }

    /** * @Since("6.5.2.0") */
    #[Route(path: '/api/_action/trigger-event/{eventName}', name: 'api.action.trigger_event', methods: ['POST'])]     public function trigger(string $eventName, Request $request, Context $context): JsonResponse
    {
        $data = $request->request->all();

        $this->checkAppEventIsExist($eventName$context);

        $this->eventDispatcher->dispatch(new CustomAppEvent($eventName$data$context)$eventName);

        return new JsonResponse([
            'message' => \sprintf('The trigger `%s`successfully dispatched!', $eventName),
        ], Response::HTTP_OK);
    }

    private function checkAppEventIsExist(string $eventName, Context $context): void
    {
        $criteria = new Criteria();
        
Home | Imprint | This part of the site doesn't use cookies.