feature/RVRNEXT-43-split-transactions #59

Merged
bence merged 9 commits from feature/RVRNEXT-43-split-transactions into master 2023-06-17 14:59:09 +02:00
Showing only changes of commit 4e9c7f8c3c - Show all commits

View File

@ -15,12 +15,16 @@ class CommunityMemberRepository
public function getAllByCommunity(Community $community, bool $useRelations = false, array $withRelations = []): Generator public function getAllByCommunity(Community $community, bool $useRelations = false, array $withRelations = []): Generator
{ {
$select = new Select(\Container::$dbConnection); $select = $this->selectAllByCommunity($community);
$select->where('community_id', '=', $community->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, CommunityMember::class, $useRelations, $withRelations); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, CommunityMember::class, $useRelations, $withRelations);
} }
public function countAllByCommunity(Community $community): int
{
return $this->selectAllByCommunity($community)->count();
}
public function getAllByUser(User $user, bool $useRelations = false, array $withRelations = []): Generator public function getAllByUser(User $user, bool $useRelations = false, array $withRelations = []): Generator
{ {
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
@ -37,4 +41,11 @@ class CommunityMemberRepository
return \Container::$persistentDataManager->selectFromDb($select, CommunityMember::class); return \Container::$persistentDataManager->selectFromDb($select, CommunityMember::class);
} }
private function selectAllByCommunity(Community $community): Select
{
$select = new Select(\Container::$dbConnection, CommunityMember::getTable());
$select->where('community_id', '=', $community->getId());
return $select;
}
} }