Passed
Push — master ( a34e41...faa861 )
by Will
04:01
created

HistoryController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 10 1
1
<?php
2
3
namespace App\Controller;
4
5
use App\Entity\Transaction;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Symfony\Component\Routing\Annotation\Route;
8
9
class HistoryController extends Controller
10
{
11
    /**
12
     * @Route("/history", name="history")
13
     */
14
    public function index()
15
    {
16
        $user = $this->getUser();
17
        $transactions = $this->getDoctrine()->getRepository(Transaction::class)->findBy(
18
            ['user_id' => $user->getUsername()],
19
            ['date' => 'DESC']
20
        );
21
        return $this->render('views/history.html.twig', [
22
            'full_name' => $user->getFirstName() . ' ' . $user->getLastName(),
23
            'transactions' => $transactions
24
        ]);
25
    }
26
}
27