mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 19:00:22 -06:00
Fix for #2070
This commit is contained in:
parent
e0aa7f3ff5
commit
0d0906c5e2
@ -383,15 +383,16 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
* Return a list of all destination accounts related to journal.
|
* Return a list of all destination accounts related to journal.
|
||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
|
* @param bool $useCache
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getJournalDestinationAccounts(TransactionJournal $journal): Collection
|
public function getJournalDestinationAccounts(TransactionJournal $journal, bool $useCache = true): Collection
|
||||||
{
|
{
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty($journal->id);
|
$cache->addProperty($journal->id);
|
||||||
$cache->addProperty('destination-account-list');
|
$cache->addProperty('destination-account-list');
|
||||||
if ($cache->has()) {
|
if ($useCache && $cache->has()) {
|
||||||
return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$transactions = $journal->transactions()->where('amount', '>', 0)->orderBy('transactions.account_id')->with('account')->get();
|
$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.
|
* Return a list of all source accounts related to journal.
|
||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
|
* @param bool $useCache
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getJournalSourceAccounts(TransactionJournal $journal): Collection
|
public function getJournalSourceAccounts(TransactionJournal $journal, bool $useCache = true): Collection
|
||||||
{
|
{
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty($journal->id);
|
$cache->addProperty($journal->id);
|
||||||
$cache->addProperty('source-account-list');
|
$cache->addProperty('source-account-list');
|
||||||
if ($cache->has()) {
|
if ($useCache && $cache->has()) {
|
||||||
return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$transactions = $journal->transactions()->where('amount', '<', 0)->orderBy('transactions.account_id')->with('account')->get();
|
$transactions = $journal->transactions()->where('amount', '<', 0)->orderBy('transactions.account_id')->with('account')->get();
|
||||||
|
Loading…
Reference in New Issue
Block a user