AdminController::homepageAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
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