G
G
gitdev2021-02-04 21:29:56
symfony
gitdev, 2021-02-04 21:29:56

Is it possible and necessary to take out addFlash to the service?

For example, after creating a new vacancy, I add flash, it can be placed in the service. Is it worth it?

$vacancy = $this->vacancyService->createEntity();
        $form = $this->createForm(VacancyType::class, $vacancy);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->vacancyService->create($vacancy, $this->getUser());

            $this->addFlash('success', 'Vacancy created');

            return $this->redirectToRoute('vacancies');
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question