RVRNEXT-28 add further checks before manupulating db
rvr-nextgen/pipeline/pr-master This commit looks good

This commit is contained in:
bence committed 2023-05-02 02:56:16 +02:00
1 parent 1f32387f63
commit cb76cbb9b1
2 files changed
+39

No files matched your search

+17
View File
@@ -3,6 +3,7 @@
use Container;
use Generator;
use RVR\PersistentData\Model\Community;
use RVR\PersistentData\Model\Currency;
use RVR\PersistentData\Model\Transaction;
use RVR\PersistentData\Model\User;
use SokoWeb\Database\Query\Select;
@@ -36,6 +37,22 @@ class TransactionRepository
return $select->count() > 0;
}
public function isAnyCommon(): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('payee_user_id', '=', null);
return $select->count() > 0;
}
public function isAnyForCurrency(Currency $currency): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('currency_id', '=', $currency->getId());
return $select->count() > 0;
}
public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator
{
$select = new Select(Container::$dbConnection);