RVRNEXT-30 check if member already has associated transaction
rvr-nextgen/pipeline/pr-master This commit looks good

This commit is contained in:
bence committed 2023-05-02 02:40:27 +02:00
1 parent 38d18873b8
commit be93c75fe7
2 files changed
+22

No files matched your search

+11
View File
@@ -4,6 +4,7 @@ use Container;
use Generator;
use RVR\PersistentData\Model\Community;
use RVR\PersistentData\Model\Transaction;
use RVR\PersistentData\Model\User;
use SokoWeb\Database\Query\Select;
class TransactionRepository
@@ -25,6 +26,16 @@ class TransactionRepository
return $this->selectAllByCommunity($community)->count();
}
public function isAnyForUser(User $user): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('payer_user_id', '=', $user->getId());
$select->orWhere('payee_user_id', '=', $user->getId());
$select->orWhere('payee_user_id', '=', null);
return $select->count() > 0;
}
public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator
{
$select = new Select(Container::$dbConnection);