Allow to retrieve wallet statements in either direction of an accounting

This commit is contained in:
2024-10-23 15:05:02 +02:00
parent c7b4ab0fee
commit fb527db4d9
@@ -18,6 +18,22 @@ class WalletStatementRepository extends ServiceEntityRepository
parent::__construct($registry, WalletStatement::class);
}
/**
* @return WalletStatement[]
*/
public function findByAccounting(Accounting $accounting): array
{
return $this->createQueryBuilder('w')
->join('w.transaction', 'wt', Join::WITH, 'wt.id = w.transaction')
->where('wt.origin = :val')
->orWhere('wt.target = :val')
->setParameter('val', $accounting->getId())
->orderBy('w.id', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return WalletStatement[]
*/