Passed
Push — develop ( 5c069a...34195e )
by Stone
04:14
created

TrickHistoryController::index()   A

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\Routing\Annotation\Route;
10
11
/**
12
 * Class TrickHistoryController
13
 * @package App\Controller\Trick\Admin
14
 * @IsGranted("ROLE_ADMIN")
15
 */
16
class TrickHistoryController extends AbstractController
17
{
18
19
    /**
20
     * @var TrickHistory
21
     */
22
    private $trickHistory;
23
24
    public function __construct(TrickHistory $trickHistory)
25
    {
26
        $this->trickHistory = $trickHistory;
27
    }
28
29
    /**
30
     * @Route("/trick/edit/history/{id}", name="trick.history")
31
     * @return \Symfony\Component\HttpFoundation\Response
32
     */
33
    public function index(Trick $trick)
34
    {
35
36
        $history = $this->trickHistory->getHistory($trick->getId());
37
38
        return $this->render('trick/admin/trick-history.html.twig', [
39
            'trick' => $trick,
40
            'history' => $history,
41
        ]);
42
    }
43
}
44