mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Refactor findNull to find
This commit is contained in:
@@ -48,7 +48,7 @@ class TagOrId implements BinderInterface
|
||||
|
||||
$result = $repository->findByTag($value);
|
||||
if (null === $result) {
|
||||
$result = $repository->findNull((int)$value);
|
||||
$result = $repository->find((int)$value);
|
||||
}
|
||||
if (null !== $result) {
|
||||
return $result;
|
||||
|
||||
@@ -74,7 +74,7 @@ trait ChartGeneration
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
// See reference nr. 33
|
||||
$currency = $repository->findNull((int)$accountRepos->getMetaValue($account, 'currency_id'));
|
||||
$currency = $repository->find((int)$accountRepos->getMetaValue($account, 'currency_id'));
|
||||
if (null === $currency) {
|
||||
$currency = $default;
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ trait RenderPartialViews
|
||||
|
||||
/** @var BudgetRepositoryInterface $budgetRepository */
|
||||
$budgetRepository = app(BudgetRepositoryInterface::class);
|
||||
$budget = $budgetRepository->findNull((int)$attributes['budgetId']);
|
||||
$budget = $budgetRepository->find((int)$attributes['budgetId']);
|
||||
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$account = $accountRepos->findNull((int)$attributes['accountId']);
|
||||
$account = $accountRepos->find((int)$attributes['accountId']);
|
||||
|
||||
$journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
|
||||
|
||||
@@ -110,7 +110,7 @@ trait RenderPartialViews
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
$budget = $budgetRepository->findNull((int)$attributes['budgetId']);
|
||||
$budget = $budgetRepository->find((int)$attributes['budgetId']);
|
||||
if (null === $budget) {
|
||||
$budget = new Budget;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ trait RenderPartialViews
|
||||
|
||||
/** @var CategoryRepositoryInterface $categoryRepository */
|
||||
$categoryRepository = app(CategoryRepositoryInterface::class);
|
||||
$category = $categoryRepository->findNull((int)$attributes['categoryId']);
|
||||
$category = $categoryRepository->find((int)$attributes['categoryId']);
|
||||
$journals = $popupHelper->byCategory($category, $attributes);
|
||||
|
||||
try {
|
||||
@@ -227,7 +227,7 @@ trait RenderPartialViews
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
$account = $accountRepository->findNull((int)$attributes['accountId']);
|
||||
$account = $accountRepository->find((int)$attributes['accountId']);
|
||||
|
||||
if (null === $account) {
|
||||
return 'This is an unknown account. Apologies.';
|
||||
@@ -348,7 +348,7 @@ trait RenderPartialViews
|
||||
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$account = $accountRepository->findNull((int)$attributes['accountId']);
|
||||
$account = $accountRepository->find((int)$attributes['accountId']);
|
||||
|
||||
if (null === $account) {
|
||||
return 'This is an unknown category. Apologies.';
|
||||
|
||||
@@ -334,7 +334,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->searchAccount($value, 1, 3);
|
||||
break;
|
||||
case 'source_account_id':
|
||||
$account = $this->accountRepository->findNull((int)$value);
|
||||
$account = $this->accountRepository->find((int)$value);
|
||||
if (null !== $account) {
|
||||
$this->collector->setSourceAccounts(new Collection([$account]));
|
||||
}
|
||||
@@ -372,7 +372,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->searchAccount($value, 2, 3);
|
||||
break;
|
||||
case 'destination_account_id':
|
||||
$account = $this->accountRepository->findNull((int)$value);
|
||||
$account = $this->accountRepository->find((int)$value);
|
||||
if (null !== $account) {
|
||||
$this->collector->setDestinationAccounts(new Collection([$account]));
|
||||
}
|
||||
@@ -381,7 +381,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$parts = explode(',', $value);
|
||||
$collection = new Collection;
|
||||
foreach ($parts as $accountId) {
|
||||
$account = $this->accountRepository->findNull((int)$accountId);
|
||||
$account = $this->accountRepository->find((int)$accountId);
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user