HistoryController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
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
/**
10
 *
11
 * Displays previous payments the user has made.
12
 */
13
14
class HistoryController extends Controller
15
{
16
    /**
17
     * @Route("/history", name="history")
18
     */
19
    public function index()
20
    {
21
        $user = $this->getUser();
22
        $transactions = $this->getDoctrine()->getRepository(Transaction::class)->findBy(
23
            ['user_id' => $user->getUsername()],
24
            ['date' => 'DESC']
25
        );
26
        return $this->render('views/history.html.twig', [
27
            'full_name' => $user->getFullName(),
28
            'transactions' => $transactions
29
        ]);
30
    }
31
}
32