This commit is contained in:
James Cole
2019-01-11 16:57:40 +01:00
parent ba778d4c60
commit 7f91ff4b0c
3 changed files with 74 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Destroy;
use DB;
use Exception;
use FireflyIII\Models\Category;
use Log;
@@ -52,5 +53,11 @@ class CategoryDestroyService
} catch (Exception $e) { // @codeCoverageIgnore
Log::error(sprintf('Could not delete category: %s', $e->getMessage())); // @codeCoverageIgnore
}
// also delete all relations between categories and transaction journals:
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
// also delete all relations between categories and transactions:
DB::table('category_transaction')->where('category_id', (int)$category->id)->delete();
}
}