mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
If you get the source account attribute before the model is saved, the cache breaks.
This commit is contained in:
parent
cf4d7cfeef
commit
ae3258b449
@ -308,16 +308,8 @@ class TransactionJournal extends Model
|
||||
*/
|
||||
public function getSourceAccountAttribute()
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($this->id);
|
||||
$cache->addProperty('sourceAccount');
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$account = $this->transactions()->where('amount', '<', 0)->first()->account;
|
||||
|
||||
$cache->store($account);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user