AdminController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A homepageAction() 0 15 1
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use AppBundle\Entity\Category;
6
use AppBundle\Entity\Meal;
7
use AppBundle\Entity\Order;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10
11
class AdminController extends Controller
12
{
13
    /**
14
     * @Route(path="/admin", name="admin_index")
15
     */
16
    public function homepageAction()
17
    {
18
        $orders = $this->getDoctrine()->getRepository(Order::class)->findLatest(5);
19
        $categoryCount = $this->getDoctrine()->getRepository(Category::class)->countAll();
20
        $mealCount = $this->getDoctrine()->getRepository(Meal::class)->countAll();
21
22
        $firstAvailableTime = $this->get('planning')->getFirstAvailableTime();
23
24
        return $this->render('admin/index.html.twig', array(
25
            'orders' => $orders,
26
            'category_count' => $categoryCount,
27
            'meal_count' => $mealCount,
28
            'first_available_time' => $firstAvailableTime,
29
        ));
30
    }
31
}
32