Completed
Pull Request — master (#2)
by Andrew
14:50
created

SiteController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 2
c 4
b 0
f 3
lcom 1
cbo 1
dl 0
loc 22
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 4 1
A menuAction() 0 7 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: kate
5
 * Date: 17.02.16
6
 * Time: 9:30
7
 */
8
9
namespace AppBundle\Controller;
10
11
12
use AppBundle\MenuItem\RecursiveMenuItemIterator;
13
use Doctrine\Common\Collections\ArrayCollection;
14
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
15
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Response;
18
use AppBundle\Entity\Cat as CategoryEntity;
19
20
class SiteController extends Controller
21
{
22
    /**
23
     * @Route("/", name="homepage")
24
     */
25
    public function indexAction(Request $request)
26
    {
27
        return $this->render("AppBundle::site/index.html.twig");
28
    }
29
30
    /**
31
     * @Route("/menu", name="menu")
32
     */
33
    public function menuAction(Request $request)
34
    {
35
        $em = $this->getDoctrine()->getManager();
36
        $categoryEntity = $em->getRepository('AppBundle\Entity\Category');
37
        $categories = $categoryEntity->childrenHierarchy();
38
        return $this->render("AppBundle::includes/menu.html.twig", ['links' => $categories]);
39
    }
40
41
}