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

HistoryController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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