TrickHistoryController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Controller\Trick\Admin;
4
5
use App\Entity\Trick;
6
use App\History\TrickHistory;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
8
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Component\Routing\Annotation\Route;
11
12
/**
13
 * Class TrickHistoryController
14
 * @package App\Controller\Trick\Admin
15
 * @IsGranted("ROLE_ADMIN")
16
 */
17
class TrickHistoryController extends AbstractController
18
{
19
20
    /**
21
     * @var TrickHistory
22
     */
23
    private $trickHistory;
24
25
    public function __construct(TrickHistory $trickHistory)
26
    {
27
        $this->trickHistory = $trickHistory;
28
    }
29
30
    /**
31
     * @Route("/trick/edit/history/{id}", name="trick.history")
32
     * @return Response
33
     */
34
    public function index(Trick $trick)
35
    {
36
37
        $history = $this->trickHistory->getHistory($trick->getId());
38
39
        return $this->render('trick/admin/trick-history.html.twig', [
40
            'trick' => $trick,
41
            'history' => $history,
42
        ]);
43
    }
44
}
45