<?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); } }