Failed Conditions
Push — master ( 5fbadf...673c47 )
by Adrien
07:14
created

TransactionLineRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByDebitOrCredit() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Repository;
6
7
use Application\Model\Account;
8
use Application\Model\TransactionLine;
9
10
class TransactionLineRepository extends AbstractRepository
11
{
12
    /**
13
     * Get all transaction lines matching a given account in credit or debit
14
     *
15
     * @return TransactionLine[]
16
     */
17 1
    public function findByDebitOrCredit(Account $account): array
18
    {
19 1
        $qb = $this->createQueryBuilder('line')
20 1
            ->where('line.debit = :account')
21 1
            ->orWhere('line.credit = :account')
22 1
            ->setParameter('account', $account);
23
24 1
        $query = $qb->getQuery();
25
26 1
        $result = $query->getResult();
27
28 1
        return $result;
29
    }
30
}
31