diff --git a/src/Repository/WalletStatementRepository.php b/src/Repository/WalletStatementRepository.php index 0e2c511..5277a5e 100644 --- a/src/Repository/WalletStatementRepository.php +++ b/src/Repository/WalletStatementRepository.php @@ -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[] */