Coderberg /
ResidenceCMS
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace App\Controller; |
||
| 6 | |||
| 7 | use App\Dto\FeedbackDto; |
||
| 8 | use App\Entity\Page; |
||
| 9 | use App\Form\Type\FeedbackType; |
||
| 10 | use App\Message\SendFeedback; |
||
| 11 | use App\Repository\PageRepository; |
||
| 12 | use Symfony\Component\HttpFoundation\Request; |
||
| 13 | use Symfony\Component\HttpFoundation\Response; |
||
| 14 | use Symfony\Component\Messenger\MessageBusInterface; |
||
| 15 | use Symfony\Component\Routing\Annotation\Route; |
||
| 16 | |||
| 17 | final class PageController extends BaseController |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @Route("/info/{slug}", methods={"GET|POST"}, name="page") |
||
| 21 | */ |
||
| 22 | public function pageShow(Request $request, MessageBusInterface $messageBus, PageRepository $pageRepository): Response |
||
| 23 | { |
||
| 24 | $slug = $request->attributes->get('slug'); |
||
| 25 | $page = $pageRepository->findOneBy(['locale' => $request->getLocale(), 'slug' => $slug]) |
||
| 26 | ?? $pageRepository->findOneBy(['slug' => $slug]); |
||
| 27 | |||
| 28 | if ($page->getAddContactForm() && '' !== $page->getContactEmailAddress()) { |
||
|
0 ignored issues
–
show
|
|||
| 29 | $feedback = new FeedbackDto(); |
||
| 30 | $feedback->setToEmail($page->getContactEmailAddress()); |
||
| 31 | |||
| 32 | $form = $this->createForm(FeedbackType::class, $feedback); |
||
| 33 | $form->handleRequest($request); |
||
| 34 | |||
| 35 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 36 | $messageBus->dispatch(new SendFeedback($feedback)); |
||
| 37 | $this->addFlash('success', 'message.was_sent'); |
||
| 38 | |||
| 39 | return $this->redirectToRoute('page', ['slug' => $page->getSlug()]); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->render('page/show.html.twig', |
||
| 44 | [ |
||
| 45 | 'site' => $this->site($request), |
||
| 46 | 'page' => $page, |
||
| 47 | 'form' => (!empty($form) ? $form->createView() : []), |
||
| 48 | ] |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.