This commit is contained in:
James Cole 2019-02-16 11:43:05 +01:00
parent e0aa7f3ff5
commit 0d0906c5e2

View File

@ -383,15 +383,16 @@ class JournalRepository implements JournalRepositoryInterface
* Return a list of all destination accounts related to journal.
*
* @param TransactionJournal $journal
* @param bool $useCache
*
* @return Collection
*/
public function getJournalDestinationAccounts(TransactionJournal $journal): Collection
public function getJournalDestinationAccounts(TransactionJournal $journal, bool $useCache = true): Collection
{
$cache = new CacheProperties;
$cache->addProperty($journal->id);
$cache->addProperty('destination-account-list');
if ($cache->has()) {
if ($useCache && $cache->has()) {
return $cache->get(); // @codeCoverageIgnore
}
$transactions = $journal->transactions()->where('amount', '>', 0)->orderBy('transactions.account_id')->with('account')->get();
@ -410,15 +411,16 @@ class JournalRepository implements JournalRepositoryInterface
* Return a list of all source accounts related to journal.
*
* @param TransactionJournal $journal
* @param bool $useCache
*
* @return Collection
*/
public function getJournalSourceAccounts(TransactionJournal $journal): Collection
public function getJournalSourceAccounts(TransactionJournal $journal, bool $useCache = true): Collection
{
$cache = new CacheProperties;
$cache->addProperty($journal->id);
$cache->addProperty('source-account-list');
if ($cache->has()) {
if ($useCache && $cache->has()) {
return $cache->get(); // @codeCoverageIgnore
}
$transactions = $journal->transactions()->where('amount', '<', 0)->orderBy('transactions.account_id')->with('account')->get();