Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update app() calls
James Cole8a98204a69ac
diff --git a/app/Console/Commands/CreateImport.php b/app/Console/Commands/CreateImport.phpindex 41fd83d762..00ff5094c6 100644--- a/app/Console/Commands/CreateImport.php+++ b/app/Console/Commands/CreateImport.php@@ -79,7 +79,8 @@ class CreateImport extends Command$this->info(sprintf('Type of import: %s', $type));/** @var ImportJobRepositoryInterface $jobRepository */- $jobRepository = app(ImportJobRepositoryInterface::class, [$user]);+ $jobRepository = app(ImportJobRepositoryInterface::class);+ $jobRepository->setUser($user);$job = $jobRepository->create($type);$this->line(sprintf('Created job "%s"...', $job->key));diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.phpindex 9c21b1a0ba..02cc9d08c2 100644--- a/app/Generator/Report/Audit/MonthReportGenerator.php+++ b/app/Generator/Report/Audit/MonthReportGenerator.php@@ -139,7 +139,8 @@ class MonthReportGenerator implements ReportGeneratorInterface{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);$journals = $collector->getJournals();$journals = $journals->reverse();diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.phpindex 38a53aad79..3ab5227ecc 100644--- a/app/Generator/Report/Budget/MonthReportGenerator.php+++ b/app/Generator/Report/Budget/MonthReportGenerator.php@@ -185,7 +185,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface}/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL])->setBudgets($this->budgets)->withOpposingAccount()->disableFilter();diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.phpindex 5517d7be13..865121006e 100644--- a/app/Generator/Report/Category/MonthReportGenerator.php+++ b/app/Generator/Report/Category/MonthReportGenerator.php@@ -195,7 +195,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface}/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])->setCategories($this->categories)->withOpposingAccount()->disableFilter();@@ -218,7 +219,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface}/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->setCategories($this->categories)->withOpposingAccount();diff --git a/app/Helpers/Chart/MetaPieChart.php b/app/Helpers/Chart/MetaPieChart.phpindex fbeb70cc25..e83b103ba0 100644--- a/app/Helpers/Chart/MetaPieChart.php+++ b/app/Helpers/Chart/MetaPieChart.php@@ -85,7 +85,8 @@ class MetaPieChart implements MetaPieChartInterface// also collect all other transactionsif ($this->collectOtherObjects && $direction === 'expense') {/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL]);$journals = $collector->getJournals();$sum = strval($journals->sum('transaction_amount'));@@ -96,7 +97,8 @@ class MetaPieChart implements MetaPieChartInterfaceif ($this->collectOtherObjects && $direction === 'income') {/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::DEPOSIT]);$journals = $collector->getJournals();$sum = strval($journals->sum('transaction_amount'));@@ -201,7 +203,8 @@ class MetaPieChart implements MetaPieChartInterface$modifier = 1;}/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts);$collector->setRange($this->start, $this->end);$collector->setTypes($types);@@ -258,7 +261,8 @@ class MetaPieChart implements MetaPieChartInterface{$chartData = [];$names = [];- $repository = app($this->repositories[$type], [$this->user]);+ $repository = app($this->repositories[$type]);+ $repository->setUser($this->user);foreach ($array as $objectId => $amount) {if (!isset($names[$objectId])) {$object = $repository->find(intval($objectId));diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.phpindex 7952ed2e2f..6e2d7a0d8e 100644--- a/app/Helpers/Collector/JournalCollector.php+++ b/app/Helpers/Collector/JournalCollector.php@@ -233,7 +233,8 @@ class JournalCollector implements JournalCollectorInterfacepublic function setAllAssetAccounts(): JournalCollectorInterface{/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);$accounts = $repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);if ($accounts->count() > 0) {$accountIds = $accounts->pluck('id')->toArray();diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 40b7b68eaf..f49805cd1b 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -68,7 +68,8 @@ class ReportHelper implements ReportHelperInterface/** @var BillRepositoryInterface $repository */$repository = app(BillRepositoryInterface::class);$bills = $repository->getBillsForAccounts($accounts);- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($accounts)->setRange($start, $end)->setBills($bills);$journals = $collector->getJournals();$collection = new BillCollection;diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex b3b007cb9e..92d06ece6f 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -23,7 +23,6 @@ use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;use FireflyIII\Models\Transaction;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Support\CacheProperties;@@ -97,12 +96,12 @@ class AccountController extends Controller}/**- * @param ARI $repository- * @param Account $account+ * @param AccountRepositoryInterface $repository+ * @param Account $account** @return View*/- public function delete(ARI $repository, Account $account)+ public function delete(AccountRepositoryInterface $repository, Account $account){$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);@@ -119,12 +118,12 @@ class AccountController extends Controller/*** @param Request $request- * @param ARI $repository+ * @param AccountRepositoryInterface $repository* @param Account $account** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector*/- public function destroy(Request $request, ARI $repository, Account $account)+ public function destroy(Request $request, AccountRepositoryInterface $repository, Account $account){$type = $account->accountType->type;$typeName = config('firefly.shortNamesByFullName.' . $type);@@ -199,12 +198,12 @@ class AccountController extends Controller}/**- * @param ARI $repository+ * @param AccountRepositoryInterface $repository* @param string $what** @return View*/- public function index(ARI $repository, string $what)+ public function index(AccountRepositoryInterface $repository, string $what){$what = $what ?? 'asset';$subTitle = trans('firefly.' . $what . '_accounts');@@ -270,7 +269,7 @@ class AccountController extends Controller/*** @param Request $request- * @param ARI $repository+ * @param AccountRepositoryInterface $repository* @param Account $account** @return View@@ -284,7 +283,8 @@ class AccountController extends Controller// replace with journal collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);$journals = $collector->getPaginatedJournals();$journals->setPath('accounts/show/' . $account->id . '/all');@@ -318,7 +318,8 @@ class AccountController extends Controller// replace with journal collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);$journals = $collector->getPaginatedJournals();$journals->setPath('accounts/show/' . $account->id . '/' . $date);@@ -332,12 +333,12 @@ class AccountController extends Controller/*** @param AccountFormRequest $request- * @param ARI $repository+ * @param AccountRepositoryInterface $repository** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector**/- public function store(AccountFormRequest $request, ARI $repository)+ public function store(AccountFormRequest $request, AccountRepositoryInterface $repository){$data = $request->getAccountData();$account = $repository->store($data);@@ -365,12 +366,12 @@ class AccountController extends Controller/*** @param AccountFormRequest $request- * @param ARI $repository+ * @param AccountRepositoryInterface $repository* @param Account $account** @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector*/- public function update(AccountFormRequest $request, ARI $repository, Account $account)+ public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account){$data = $request->getAccountData();$repository->update($account, $data);@@ -417,8 +418,8 @@ class AccountController extends Controller*/private function periodEntries(Account $account): Collection{- /** @var ARI $repository */- $repository = app(ARI::class);+ /** @var AccountRepositoryInterface $repository */+ $repository = app(AccountRepositoryInterface::class);/** @var AccountTaskerInterface $tasker */$tasker = app(AccountTaskerInterface::class);diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.phpindex 0642dd260b..913ac09208 100644--- a/app/Http/Controllers/BillController.php+++ b/app/Http/Controllers/BillController.php@@ -215,7 +215,8 @@ class BillController extends Controller// use collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();$journals = $collector->getPaginatedJournals();diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex 0d8ce65937..aaf56a50ec 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -212,7 +212,8 @@ class BudgetController extends Controller// collector/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget();$journals = $collector->getPaginatedJournals();$journals->setPath('/budgets/list/noBudget');@@ -253,7 +254,8 @@ class BudgetController extends Controller$repetition = null;// collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();$journals = $collector->getPaginatedJournals();$journals->setPath('/budgets/show/' . $budget->id);@@ -290,7 +292,8 @@ class BudgetController extends Controller// collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();$journals = $collector->getPaginatedJournals();diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex 2a52505818..81f1e230d9 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -165,7 +165,8 @@ class CategoryController extends Controller// new collector:/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setRange($start, $end)->withoutCategory();//->groupJournals();$journals = $collector->getJournals();$subTitle = trans(diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 0a8fe543cf..2c792fa908 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -416,7 +416,8 @@ class BudgetController extends Controller{// collector/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$types = [TransactionType::WITHDRAWAL];$collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget();$journals = $collector->getJournals();diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.phpindex d131f8a661..b5ab26355c 100644--- a/app/Http/Controllers/Chart/BudgetReportController.php+++ b/app/Http/Controllers/Chart/BudgetReportController.php@@ -239,7 +239,8 @@ class BudgetReportController extends Controllerprivate function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])->setBudgets($budgets)->withOpposingAccount()->disableFilter();$accountIds = $accounts->pluck('id')->toArray();diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.phpindex e156becd7e..0cd50c308c 100644--- a/app/Http/Controllers/Chart/CategoryReportController.php+++ b/app/Http/Controllers/Chart/CategoryReportController.php@@ -284,7 +284,8 @@ class CategoryReportController extends Controllerprivate function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])->setCategories($categories)->withOpposingAccount()->disableFilter();$accountIds = $accounts->pluck('id')->toArray();@@ -305,7 +306,8 @@ class CategoryReportController extends Controllerprivate function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->setCategories($categories)->withOpposingAccount();$accountIds = $accounts->pluck('id')->toArray();diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.phpindex 1ace8118c1..823c82e928 100644--- a/app/Http/Controllers/ExportController.php+++ b/app/Http/Controllers/ExportController.php@@ -150,7 +150,8 @@ class ExportController extends Controller$jobs->changeStatus($job, 'export_status_make_exporter');/** @var ProcessorInterface $processor */- $processor = app(ProcessorInterface::class, [$settings]);+ $processor = app(ProcessorInterface::class);+ $processor->setSettings($settings);/** Collect journals:diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.phpindex 0f436dc962..7bd8803fa5 100644--- a/app/Http/Controllers/Popup/ReportController.php+++ b/app/Http/Controllers/Popup/ReportController.php@@ -103,7 +103,8 @@ class ReportController extends Controllerswitch (true) {case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)):/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])@@ -114,7 +115,8 @@ class ReportController extends Controllercase ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):$budget->name = strval(trans('firefly.no_budget'));/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setTypes($types)@@ -124,7 +126,8 @@ class ReportController extends Controllerbreak;case ($role === BalanceLine::ROLE_DIFFROLE):/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setTypes($types)@@ -169,7 +172,8 @@ class ReportController extends Controller$repository = app(BudgetRepositoryInterface::class);$budget = $repository->find(intval($attributes['budgetId']));/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($attributes['accounts'])@@ -203,7 +207,8 @@ class ReportController extends Controller$category = $repository->find(intval($attributes['categoryId']));$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($attributes['accounts'])->setTypes($types)->setRange($attributes['startDate'], $attributes['endDate'])->setCategory($category);@@ -230,7 +235,8 @@ class ReportController extends Controller$account = $repository->find(intval($attributes['accountId']));$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);$journals = $collector->getJournals();$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report@@ -266,7 +272,8 @@ class ReportController extends Controller$account = $repository->find(intval($attributes['accountId']));$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);$journals = $collector->getJournals();$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this reportdiff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.phpindex 8e0e466933..1d6663835a 100644--- a/app/Http/Controllers/RuleController.php+++ b/app/Http/Controllers/RuleController.php@@ -293,7 +293,7 @@ class RuleController extends Controller$range = config('firefly.test-triggers.range');/** @var TransactionMatcher $matcher */- $matcher = app('FireflyIII\Rules\TransactionMatcher');+ $matcher = app(TransactionMatcher::class);$matcher->setLimit($limit);$matcher->setRange($range);$matcher->setTriggers($triggers);@@ -357,7 +357,7 @@ class RuleController extends Controllerprivate function createDefaultRule(){/** @var RuleRepositoryInterface $repository */- $repository = app('FireflyIII\Repositories\Rule\RuleRepositoryInterface');+ $repository = app(RuleRepositoryInterface::class);if ($repository->count() === 0) {$data = [diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 2ec3e8ce5c..ba38605b8f 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -72,7 +72,8 @@ class TransactionController extends Controller$end = session('end', Navigation::endOfPeriod(new Carbon, $range));/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();@@ -122,7 +123,8 @@ class TransactionController extends Controller$subTitle = sprintf('%s (%s)', trans('firefly.title_' . $what), strtolower(trans('firefly.everything')));$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->withBudgetInformation()->withCategoryInformation();// do not filter transfers if $what = transfer.@@ -161,7 +163,8 @@ class TransactionController extends ControllerLog::debug(sprintf('Transaction index by date will show between %s and %s', $start->format('Y-m-d'), $end->format('Y-m-d')));/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.phpindex fcf92d0105..b5917242d7 100644--- a/app/Http/Requests/RuleGroupFormRequest.php+++ b/app/Http/Requests/RuleGroupFormRequest.php@@ -49,7 +49,8 @@ class RuleGroupFormRequest extends Requestpublic function rules(){/** @var RuleGroupRepositoryInterface $repository */- $repository = app(RuleGroupRepositoryInterface::class, [auth()->user()]);+ $repository = app(RuleGroupRepositoryInterface::class);+ $repository->setUser(auth()->user());$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';if (!is_null($repository->find(intval($this->get('id')))->id)) {$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id'));diff --git a/app/Import/Converter/AccountId.php b/app/Import/Converter/AccountId.phpindex 5b39999f2e..4c07790fa5 100644--- a/app/Import/Converter/AccountId.php+++ b/app/Import/Converter/AccountId.php@@ -40,7 +40,8 @@ class AccountId extends BasicConverter implements ConverterInterfacereturn new Account;}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/AssetAccountIban.php b/app/Import/Converter/AssetAccountIban.phpindex 9ed749a781..d2336c282d 100644--- a/app/Import/Converter/AssetAccountIban.php+++ b/app/Import/Converter/AssetAccountIban.php@@ -43,7 +43,8 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/AssetAccountName.php b/app/Import/Converter/AssetAccountName.phpindex 4785ae16d2..8618d52f2d 100644--- a/app/Import/Converter/AssetAccountName.php+++ b/app/Import/Converter/AssetAccountName.php@@ -43,7 +43,8 @@ class AssetAccountName extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/AssetAccountNumber.php b/app/Import/Converter/AssetAccountNumber.phpindex 5c71bf57f1..d389492c91 100644--- a/app/Import/Converter/AssetAccountNumber.php+++ b/app/Import/Converter/AssetAccountNumber.php@@ -41,7 +41,8 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/BillId.php b/app/Import/Converter/BillId.phpindex 06713afaf4..cb20e4c7c9 100644--- a/app/Import/Converter/BillId.php+++ b/app/Import/Converter/BillId.php@@ -42,7 +42,8 @@ class BillId extends BasicConverter implements ConverterInterface}/** @var BillRepositoryInterface $repository */- $repository = app(BillRepositoryInterface::class, [$this->user]);+ $repository = app(BillRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/BillName.php b/app/Import/Converter/BillName.phpindex 6c4aa2fc17..3d2dbe9a71 100644--- a/app/Import/Converter/BillName.php+++ b/app/Import/Converter/BillName.php@@ -44,7 +44,8 @@ class BillName extends BasicConverter implements ConverterInterface}/** @var BillRepositoryInterface $repository */- $repository = app(BillRepositoryInterface::class, [$this->user]);+ $repository = app(BillRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/BudgetId.php b/app/Import/Converter/BudgetId.phpindex 0fe769f70e..cf709c0beb 100644--- a/app/Import/Converter/BudgetId.php+++ b/app/Import/Converter/BudgetId.php@@ -42,7 +42,8 @@ class BudgetId extends BasicConverter implements ConverterInterface}/** @var BudgetRepositoryInterface $repository */- $repository = app(BudgetRepositoryInterface::class, [$this->user]);+ $repository = app(BudgetRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/BudgetName.php b/app/Import/Converter/BudgetName.phpindex fc5d5416fc..7ecd85530c 100644--- a/app/Import/Converter/BudgetName.php+++ b/app/Import/Converter/BudgetName.php@@ -42,7 +42,8 @@ class BudgetName extends BasicConverter implements ConverterInterface}/** @var BudgetRepositoryInterface $repository */- $repository = app(BudgetRepositoryInterface::class, [$this->user]);+ $repository = app(BudgetRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CategoryId.php b/app/Import/Converter/CategoryId.phpindex 5d538f4b90..2544a61597 100644--- a/app/Import/Converter/CategoryId.php+++ b/app/Import/Converter/CategoryId.php@@ -42,7 +42,8 @@ class CategoryId extends BasicConverter implements ConverterInterface}/** @var CategoryRepositoryInterface $repository */- $repository = app(CategoryRepositoryInterface::class, [$this->user]);+ $repository = app(CategoryRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CategoryName.php b/app/Import/Converter/CategoryName.phpindex 28e7650c1f..f8af2414b1 100644--- a/app/Import/Converter/CategoryName.php+++ b/app/Import/Converter/CategoryName.php@@ -42,7 +42,8 @@ class CategoryName extends BasicConverter implements ConverterInterface}/** @var CategoryRepositoryInterface $repository */- $repository = app(CategoryRepositoryInterface::class, [$this->user]);+ $repository = app(CategoryRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CurrencyCode.php b/app/Import/Converter/CurrencyCode.phpindex 48901cceaa..f78433ddf3 100644--- a/app/Import/Converter/CurrencyCode.php+++ b/app/Import/Converter/CurrencyCode.php@@ -36,6 +36,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface/** @var CurrencyRepositoryInterface $repository */$repository = app(CurrencyRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CurrencyId.php b/app/Import/Converter/CurrencyId.phpindex 6622899264..299cde1bf3 100644--- a/app/Import/Converter/CurrencyId.php+++ b/app/Import/Converter/CurrencyId.php@@ -42,7 +42,8 @@ class CurrencyId extends BasicConverter implements ConverterInterface}/** @var CurrencyRepositoryInterface $repository */- $repository = app(CurrencyRepositoryInterface::class, [$this->user]);+ $repository = app(CurrencyRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CurrencyName.php b/app/Import/Converter/CurrencyName.phpindex ad28107f4b..71af377582 100644--- a/app/Import/Converter/CurrencyName.php+++ b/app/Import/Converter/CurrencyName.php@@ -42,7 +42,8 @@ class CurrencyName extends BasicConverter implements ConverterInterface}/** @var CurrencyRepositoryInterface $repository */- $repository = app(CurrencyRepositoryInterface::class, [$this->user]);+ $repository = app(CurrencyRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/CurrencySymbol.php b/app/Import/Converter/CurrencySymbol.phpindex 307d409cd0..27ed50dd48 100644--- a/app/Import/Converter/CurrencySymbol.php+++ b/app/Import/Converter/CurrencySymbol.php@@ -42,7 +42,8 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface}/** @var CurrencyRepositoryInterface $repository */- $repository = app(CurrencyRepositoryInterface::class, [$this->user]);+ $repository = app(CurrencyRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);diff --git a/app/Import/Converter/OpposingAccountIban.php b/app/Import/Converter/OpposingAccountIban.phpindex c3dacbd712..ee8b40747c 100644--- a/app/Import/Converter/OpposingAccountIban.php+++ b/app/Import/Converter/OpposingAccountIban.php@@ -43,7 +43,8 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/OpposingAccountName.php b/app/Import/Converter/OpposingAccountName.phpindex 4516873a25..fa51245fd6 100644--- a/app/Import/Converter/OpposingAccountName.php+++ b/app/Import/Converter/OpposingAccountName.php@@ -42,7 +42,8 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/OpposingAccountNumber.php b/app/Import/Converter/OpposingAccountNumber.phpindex 86df680223..d513a88ae0 100644--- a/app/Import/Converter/OpposingAccountNumber.php+++ b/app/Import/Converter/OpposingAccountNumber.php@@ -43,7 +43,8 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);if (isset($this->mapping[$value])) {diff --git a/app/Import/Converter/TagSplit.php b/app/Import/Converter/TagSplit.phpindex cc99561663..d93074b7d0 100644--- a/app/Import/Converter/TagSplit.php+++ b/app/Import/Converter/TagSplit.php@@ -39,7 +39,8 @@ class TagSplitLog::debug('Exploded parts.', $parts);/** @var TagRepositoryInterface $repository */- $repository = app(TagRepositoryInterface::class, [$user]);+ $repository = app(TagRepositoryInterface::class);+ $repository->setUser($user);/** @var string $part */diff --git a/app/Import/ImportProcedure.php b/app/Import/ImportProcedure.phpindex c535d47fae..991c5addcd 100644--- a/app/Import/ImportProcedure.php+++ b/app/Import/ImportProcedure.php@@ -58,7 +58,8 @@ class ImportProcedure implements ImportProcedureInterfaceif ($job->configuration['import-account'] != 0) {/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$job->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($job->user);$validator->setDefaultImportAccount($repository->find($job->configuration['import-account']));}diff --git a/app/Import/ImportStorage.php b/app/Import/ImportStorage.phpindex 4edf17d5f8..12b5e33a6c 100644--- a/app/Import/ImportStorage.php+++ b/app/Import/ImportStorage.php@@ -159,7 +159,8 @@ class ImportStorageprivate function createImportTag(): Tag{/** @var TagRepositoryInterface $repository */- $repository = app(TagRepositoryInterface::class, [$this->user]);+ $repository = app(TagRepositoryInterface::class);+ $repository->setUser($this->user);$data = ['tag' => trans('firefly.import_with_key', ['key' => $this->job->key]),'date' => new Carbon,diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.phpindex d6d15d3ed2..9a5a254151 100644--- a/app/Import/ImportValidator.php+++ b/app/Import/ImportValidator.php@@ -177,7 +177,8 @@ class ImportValidator// find it first by new type:/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);$result = $repository->findByName($account->name, [$type]);if (is_null($result->id)) {@@ -214,7 +215,8 @@ class ImportValidator{/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);$name = 'Unknown expense account';$result = $repository->findByName($name, [AccountType::EXPENSE]);@@ -235,7 +237,8 @@ class ImportValidator{/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [$this->user]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser($this->user);$name = 'Unknown revenue account';$result = $repository->findByName($name, [AccountType::REVENUE]);@@ -382,7 +385,8 @@ class ImportValidator{if (is_null($entry->fields['currency'])) {/** @var CurrencyRepositoryInterface $repository */- $repository = app(CurrencyRepositoryInterface::class, [$this->user]);+ $repository = app(CurrencyRepositoryInterface::class);+ $repository->setUser($this->user);// is the default currency for the user or the system$defaultCode = Preferences::getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;diff --git a/app/Import/Setup/CsvSetup.php b/app/Import/Setup/CsvSetup.phpindex 20c938bda3..ff20d45958 100644--- a/app/Import/Setup/CsvSetup.php+++ b/app/Import/Setup/CsvSetup.php@@ -181,7 +181,8 @@ class CsvSetup implements SetupInterfacepublic function saveImportConfiguration(array $data, FileBag $files): bool{/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class, [auth()->user()]);+ $repository = app(AccountRepositoryInterface::class);+ $repository->setUser(auth()->user());$importId = $data['csv_import_account'] ?? 0;$account = $repository->find(intval($importId));diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.phpindex 1678cb2bcc..15a852414e 100644--- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php+++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php@@ -156,7 +156,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueueprotected function collectJournals(){/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAccounts($this->accounts)->setRange($this->startDate, $this->endDate);return $collector->getJournals();diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 8f0588dc1a..9b4f985390 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -442,7 +442,8 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setBudgets($budgets);if ($accounts->count() > 0) {@@ -468,7 +469,8 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function spentInPeriodWoBudget(Collection $accounts, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutBudget();if ($accounts->count() > 0) {diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.phpindex fb366c0812..bed2d5847f 100644--- a/app/Repositories/Category/CategoryRepository.php+++ b/app/Repositories/Category/CategoryRepository.php@@ -57,7 +57,8 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function earnedInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($accounts)->setCategories($categories);$set = $collector->getJournals();$sum = strval($set->sum('transaction_amount'));@@ -393,7 +394,8 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function spentInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setCategories($categories);@@ -421,7 +423,8 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function spentInPeriodWithoutCategory(Collection $accounts, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutCategory();if ($accounts->count() > 0) {diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex 1b0950467f..9f91816252 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -394,7 +394,8 @@ class TagRepository implements TagRepositoryInterfacepublic function earnedInPeriod(Tag $tag, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAllAssetAccounts()->setTag($tag);$set = $collector->getJournals();$sum = strval($set->sum('transaction_amount'));@@ -412,7 +413,8 @@ class TagRepository implements TagRepositoryInterfacepublic function spentInPeriod(Tag $tag, Carbon $start, Carbon $end): string{/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAllAssetAccounts()->setTag($tag);$set = $collector->getJournals();$sum = strval($set->sum('transaction_amount'));diff --git a/app/Rules/Actions/SetBudget.php b/app/Rules/Actions/SetBudget.phpindex 90d7aa6d18..e9f8c1fae9 100644--- a/app/Rules/Actions/SetBudget.php+++ b/app/Rules/Actions/SetBudget.php@@ -50,7 +50,8 @@ class SetBudget implements ActionInterfacepublic function act(TransactionJournal $journal): bool{/** @var BudgetRepositoryInterface $repository */- $repository = app(BudgetRepositoryInterface::class, [$journal->user]);+ $repository = app(BudgetRepositoryInterface::class);+ $repository->setUser($journal->user);$search = $this->action->action_value;$budgets = $repository->getActiveBudgets();$budget = $budgets->filter(diff --git a/app/Rules/Actions/SetDestinationAccount.php b/app/Rules/Actions/SetDestinationAccount.phpindex 829c4928c4..25677e546b 100644--- a/app/Rules/Actions/SetDestinationAccount.php+++ b/app/Rules/Actions/SetDestinationAccount.php@@ -60,7 +60,8 @@ class SetDestinationAccount implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$this->journal = $journal;- $this->repository = app(AccountRepositoryInterface::class, [$journal->user]);+ $this->repository = app(AccountRepositoryInterface::class);+ $this->repository->setUser($journal->user);$count = $journal->transactions()->count();if ($count > 2) {Log::error(sprintf('Cannot change destination account of journal #%d because it is a split journal.', $journal->id));diff --git a/app/Rules/Actions/SetSourceAccount.php b/app/Rules/Actions/SetSourceAccount.phpindex 5e625fe886..fc8067856c 100644--- a/app/Rules/Actions/SetSourceAccount.php+++ b/app/Rules/Actions/SetSourceAccount.php@@ -60,7 +60,8 @@ class SetSourceAccount implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$this->journal = $journal;- $this->repository = app(AccountRepositoryInterface::class, [$journal->user]);+ $this->repository = app(AccountRepositoryInterface::class);+ $this->repository->setUser($journal->user);$count = $journal->transactions()->count();if ($count > 2) {Log::error(sprintf('Cannot change source account of journal #%d because it is a split journal.', $journal->id));diff --git a/app/Rules/TransactionMatcher.php b/app/Rules/TransactionMatcher.phpindex acac7c8521..5241e4f84c 100644--- a/app/Rules/TransactionMatcher.php+++ b/app/Rules/TransactionMatcher.php@@ -78,7 +78,8 @@ class TransactionMatcherdo {// Fetch a batch of transactions from the database/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [auth()->user()]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser(auth()->user());$collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)->setTypes($this->transactionTypes);$set = $collector->getPaginatedJournals();Log::debug(sprintf('Found %d journals to check. ', $set->count()));diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.phpindex c71e1e2985..b37af85daa 100644--- a/app/Support/Search/Search.php+++ b/app/Support/Search/Search.php@@ -37,16 +37,6 @@ class Search implements SearchInterface/** @var User */private $user;- /**- * AttachmentRepository constructor.- *- * @param User $user- */- public function __construct(User $user)- {- $this->user = $user;- }-/*** The search will assume that the user does not have so many accounts* that this search should be paginated.@@ -164,7 +154,8 @@ class Search implements SearchInterface$result = new Collection();do {/** @var JournalCollectorInterface $collector */- $collector = app(JournalCollectorInterface::class, [$this->user]);+ $collector = app(JournalCollectorInterface::class);+ $collector->setUser($this->user);$collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page);$set = $collector->getPaginatedJournals();Log::debug(sprintf('Found %d journals to check. ', $set->count()));@@ -222,6 +213,14 @@ class Search implements SearchInterface$this->limit = $limit;}+ /**+ * @param User $user+ */+ public function setUser(User $user)+ {+ $this->user = $user;+ }+/*** @param string $haystack* @param array $needle@@ -241,4 +240,4 @@ class Search implements SearchInterfacereturn false;}-}+}diff --git a/app/Support/Search/SearchInterface.php b/app/Support/Search/SearchInterface.phpindex bd16c78853..ed9c3c6c88 100644--- a/app/Support/Search/SearchInterface.php+++ b/app/Support/Search/SearchInterface.php@@ -13,6 +13,7 @@ declare(strict_types = 1);namespace FireflyIII\Support\Search;+use FireflyIII\User;use Illuminate\Support\Collection;/**@@ -29,6 +30,11 @@ interface SearchInterface*/public function searchAccounts(array $words): Collection;+ /**+ * @param User $user+ */+ public function setUser(User $user);+/*** @param array $words*