mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Move method to correct repository.
This commit is contained in:
@@ -24,6 +24,8 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\Budget;
|
||||
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
|
||||
@@ -47,6 +49,20 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a budget limit.
|
||||
*
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*/
|
||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
try {
|
||||
$budgetLimit->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::info(sprintf('Could not delete budget limit: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Repositories\Budget;
|
||||
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\User;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,13 @@ use FireflyIII\User;
|
||||
*/
|
||||
interface BudgetLimitRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Destroy a budget limit.
|
||||
*
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*/
|
||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
||||
@@ -110,20 +110,6 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a budget limit.
|
||||
*
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*/
|
||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
try {
|
||||
$budgetLimit->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::info(sprintf('Could not delete budget limit: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $budgetId
|
||||
* @param string|null $budgetName
|
||||
|
||||
@@ -47,13 +47,6 @@ interface BudgetRepositoryInterface
|
||||
*/
|
||||
public function destroy(Budget $budget): bool;
|
||||
|
||||
/**
|
||||
* Destroy a budget limit.
|
||||
*
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*/
|
||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void;
|
||||
|
||||
/**
|
||||
* @param int|null $budgetId
|
||||
* @param string|null $budgetName
|
||||
@@ -72,6 +65,8 @@ interface BudgetRepositoryInterface
|
||||
public function findByName(?string $name): ?Budget;
|
||||
|
||||
/**
|
||||
* TODO refactor to "find"
|
||||
*
|
||||
* @param int|null $budgetId
|
||||
*
|
||||
* @return Budget|null
|
||||
|
||||
Reference in New Issue
Block a user