mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
If you get the destination account attribute before the model is saved, the cache breaks.
This commit is contained in:
@@ -290,15 +290,7 @@ class TransactionJournal extends Model
|
|||||||
*/
|
*/
|
||||||
public function getDestinationAccountAttribute()
|
public function getDestinationAccountAttribute()
|
||||||
{
|
{
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty($this->id);
|
|
||||||
$cache->addProperty('destinationAccount');
|
|
||||||
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get(); // @codeCoverageIgnore
|
|
||||||
}
|
|
||||||
$account = $this->transactions()->where('amount', '>', 0)->first()->account;
|
$account = $this->transactions()->where('amount', '>', 0)->first()->account;
|
||||||
$cache->store($account);
|
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user