feature/RVRNEXT-43-split-transactions #59
							
								
								
									
										23
									
								
								src/Repository/TransactionPayeeRepository.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/Repository/TransactionPayeeRepository.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
<?php namespace RVR\Repository;
 | 
			
		||||
 | 
			
		||||
use Container;
 | 
			
		||||
use Generator;
 | 
			
		||||
use RVR\PersistentData\Model\Transaction;
 | 
			
		||||
use RVR\PersistentData\Model\TransactionPayee;
 | 
			
		||||
use SokoWeb\Database\Query\Select;
 | 
			
		||||
 | 
			
		||||
class TransactionPayeeRepository
 | 
			
		||||
{
 | 
			
		||||
    public function getById(int $id): ?TransactionPayee
 | 
			
		||||
    {
 | 
			
		||||
        return Container::$persistentDataManager->selectFromDbById($id, TransactionPayee::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAllByTransaction(Transaction $transaction, bool $useRelations = false, array $withRelations = []): Generator
 | 
			
		||||
    {
 | 
			
		||||
        $select = new Select(Container::$dbConnection);
 | 
			
		||||
        $select->where('transaction_id', '=', $transaction->getId());
 | 
			
		||||
 | 
			
		||||
        yield from Container::$persistentDataManager->selectMultipleFromDb($select, TransactionPayee::class, $useRelations, $withRelations);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user