RVRNEXT-30 check if member already has associated transaction
rvr-nextgen/pipeline/pr-master This commit looks good
rvr-nextgen/pipeline/pr-master This commit looks good
This commit is contained in:
2 files changed
+22
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user