Passed
Push — master ( cbbc27...86f200 )
by Dev
11:12
created

PageAdminController::listAction()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
nc 4
nop 0
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\Controller;
4
5
use Sonata\AdminBundle\Controller\CRUDController;
6
7
class PageAdminController extends CRUDController
8
{
9
    public function listAction()
10
    {
11
        $request = $this->getRequest();
12
        if ($listMode = $request->get('_list_mode')) {
13
            $this->admin->setListMode($listMode);
14
        }
15
16
        $listMode = $this->admin->getListMode();
17
        if ('tree' === $listMode) {
18
            return $this->treeAction();
19
        }
20
21
        return parent::listAction();
22
    }
23
24
    public function treeAction()
25
    {
26
        $pages = $this->getDoctrine()
27
            ->getRepository($this->container->getParameter('app.entity_page'))
1 ignored issue
show
Bug introduced by
The method getParameter() does not exist on Psr\Container\ContainerInterface. It seems like you code against a sub-type of Psr\Container\ContainerInterface such as Symfony\Component\Depend...tion\ContainerInterface. ( Ignorable by Annotation )

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

27
            ->getRepository($this->container->/** @scrutinizer ignore-call */ getParameter('app.entity_page'))
Loading history...
28
            ->getPagesWithoutParent();
29
30
        return $this->render('@PiedWebCMS/admin/treeView.html.twig', [
0 ignored issues
show
Deprecated Code introduced by
The function Sonata\AdminBundle\Contr...RUDController::render() has been deprecated: since version 3.27, to be removed in 4.0. Use Sonata\AdminBundle\Controller\CRUDController::renderWithExtraParams() instead. ( Ignorable by Annotation )

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

30
        return /** @scrutinizer ignore-deprecated */ $this->render('@PiedWebCMS/admin/treeView.html.twig', [

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
31
            'pages' => $pages,
32
            'list' => $this->admin->getList(),
33
            'admin' => $this->admin,
34
            'base_template' => $this->getBaseTemplate(),
35
            'action' => 'list',
36
        ]);
37
    }
38
}
39