Skip to content

Commit

Permalink
Handle calls to loadRoot where the accounts table doesn't exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
instancezero committed Nov 27, 2022
1 parent 2d48943 commit f779639
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Models/LedgerAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,14 @@ public function getSubAccountList(): array

public static function loadRoot(): void
{
self::$root = LedgerAccount::with('names')
->where('code', '')
->first();
try {
self::$root = LedgerAccount::with('names')
->where('code', '')
->first();
} catch (Exception $ex) {
// Pathological case where the table doesn't exist yet.
self::$root = null;
}
}

public function matchesEntity(EntityRef $ref): bool
Expand Down

0 comments on commit f779639

Please sign in to comment.