Refactor findNull to find

This commit is contained in:
James Cole
2021-06-30 06:17:38 +02:00
parent b7ae5eda35
commit 70da5917c9
68 changed files with 120 additions and 273 deletions

View File

@@ -38,8 +38,8 @@ class AccountController extends Controller
public function moveTransactions(MoveTransactionsRequest $request): JsonResponse
{
$accountIds = $request->getAll();
$original = $this->repository->findNull($accountIds['original_account']);
$destination = $this->repository->findNull($accountIds['destination_account']);
$original = $this->repository->find($accountIds['original_account']);
$destination = $this->repository->find($accountIds['destination_account']);
/** @var AccountDestroyService $service */
$service = app(AccountDestroyService::class);

View File

@@ -38,7 +38,7 @@ use Illuminate\Http\JsonResponse;
*
* Shows income information grouped or limited by date.
* Ie. all income grouped by account + currency.
* See reference nr. 75
* See reference nr. 75
*/
class AccountController extends Controller
{
@@ -74,8 +74,9 @@ class AccountController extends Controller
}
/**
* See reference nr. 76
* See reference nr. 77
* See reference nr. 76
* See reference nr. 77
*
* @param GenericRequest $request
*
* @return JsonResponse
@@ -103,7 +104,7 @@ class AccountController extends Controller
}
/**
* See reference nr. 78
* See reference nr. 78
*
* @param GenericRequest $request
*

View File

@@ -78,8 +78,8 @@ class StoreController extends Controller
{
$manager = $this->getManager();
$data = $request->getAll();
$inward = $this->journalRepository->findNull($data['inward_id'] ?? 0);
$outward = $this->journalRepository->findNull($data['outward_id'] ?? 0);
$inward = $this->journalRepository->find($data['inward_id'] ?? 0);
$outward = $this->journalRepository->find($data['outward_id'] ?? 0);
if (null === $inward || null === $outward) {
throw new FireflyException('200024: Source or destination does not exist.');
}

View File

@@ -175,7 +175,7 @@ class BasicController extends Controller
// format amounts:
$keys = array_keys($sums);
foreach ($keys as $currencyId) {
$currency = $this->currencyRepos->findNull($currencyId);
$currency = $this->currencyRepos->find($currencyId);
if (null === $currency) {
continue;
}
@@ -239,7 +239,7 @@ class BasicController extends Controller
$return = [];
foreach ($paidAmount as $currencyId => $amount) {
$amount = bcmul($amount, '-1');
$currency = $this->currencyRepos->findNull((int)$currencyId);
$currency = $this->currencyRepos->find((int)$currencyId);
if (null === $currency) {
continue;
}
@@ -259,7 +259,7 @@ class BasicController extends Controller
foreach ($unpaidAmount as $currencyId => $amount) {
$amount = bcmul($amount, '-1');
$currency = $this->currencyRepos->findNull((int)$currencyId);
$currency = $this->currencyRepos->find((int)$currencyId);
if (null === $currency) {
continue;
}