feature/RVRNEXT-43-split-transactions #59
@ -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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user