PageController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\Routing\Annotation\Route;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class PageController extends AbstractController
10
{
11
    /**
12
     * @Route("/contents", name="ribsadmin_contents")
13
     * @return Response
14
     */
15
    public function index(): Response
16
    {
17
        $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
0 ignored issues
show
Bug introduced by
The method findAllNavigationPage() does not exist on Doctrine\Persistence\ObjectRepository. Did you maybe mean findAll()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->/** @scrutinizer ignore-call */ findAllNavigationPage();

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.

Loading history...
18
19
        return $this->render('@RibsAdmin/page/index.html.twig', ["navigation" => $navigation]);
20
    }
21
22
    /**
23
     * @Route("/contents/edit-page/{page_id}", name="ribsadmin_contents_edit_page")
24
     * @param int $page_id
25
     * @return Response
26
     */
27
    public function editPage(int $page_id): Response
28
    {
29
        $em = $this->getDoctrine()->getManager();
30
        $navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
31
        $page = $em->getRepository("RibsAdminBundle:Page")->find($page_id);
32
33
        return $this->render('@RibsAdmin/page/edit-page.html.twig', ["navigation" => $navigation, "page" => $page]);
34
    }
35
}
36