mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
@@ -24,8 +24,10 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -49,17 +51,19 @@ class AccountDestroyService
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($account->transactions()->get() as $transaction) {
|
||||
Log::debug('Now at transaction #' . $transaction->id);
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $transaction->transactionJournal()->first();
|
||||
if (null !== $journal) {
|
||||
Log::debug('Call for deletion of journal #' . $journal->id);
|
||||
$journal->delete();
|
||||
/** @var JournalDestroyService $service */
|
||||
$service = app(JournalDestroyService::class);
|
||||
$service->destroy($journal);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$account->delete();
|
||||
} catch (\Exception $e) {
|
||||
// don't care
|
||||
Log::error($e->getMessage());
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete account: %s',$e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Bill;
|
||||
|
||||
use Log;
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class BillDestroyService
|
||||
*/
|
||||
class BillDestroyService
|
||||
@@ -38,8 +39,8 @@ class BillDestroyService
|
||||
{
|
||||
try {
|
||||
$bill->delete();
|
||||
} catch (Exception $e) {
|
||||
// don't care.
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete bill: %s',$e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionJournalMeta;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class JournalDestroyService
|
||||
*/
|
||||
class JournalDestroyService
|
||||
@@ -55,7 +56,7 @@ class JournalDestroyService
|
||||
}
|
||||
$journal->delete();
|
||||
} catch (Exception $e) {
|
||||
// don't care
|
||||
Log::error(sprintf('Could not delete bill: %s',$e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user