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

@@ -117,7 +117,7 @@ trait DepositValidation
// if the user submits an ID only but that ID is not of the correct type,
// return false.
if (null !== $accountId && null === $accountName) {
$search = $this->accountRepository->findNull($accountId);
$search = $this->accountRepository->find($accountId);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
Log::debug(sprintf('User submitted only an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
$result = false;

View File

@@ -75,7 +75,7 @@ trait LiabilityValidation
}
Log::debug('Destination ID is not null.');
$search = $this->accountRepository->findNull($accountId);
$search = $this->accountRepository->find($accountId);
// the source resulted in an account, but it's not of a valid type.
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {

View File

@@ -115,7 +115,7 @@ trait OBValidation
// return false.
if (null !== $accountId && null === $accountName) {
Log::debug('Source ID is not null, but name is null.');
$search = $this->accountRepository->findNull($accountId);
$search = $this->accountRepository->find($accountId);
// the source resulted in an account, but it's not of a valid type.
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {

View File

@@ -46,7 +46,7 @@ trait ReconciliationValidation
return false;
}
$result = $this->accountRepository->findNull($accountId);
$result = $this->accountRepository->find($accountId);
if (null === $result) {
$this->destError = (string)trans('validation.deposit_dest_bad_data', ['id' => $accountId, 'name' => '']);
Log::debug('Return FALSE');
@@ -92,7 +92,7 @@ trait ReconciliationValidation
return false;
}
$result = $this->accountRepository->findNull($accountId);
$result = $this->accountRepository->find($accountId);
$types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::RECONCILIATION];
if (null === $result) {
Log::debug('Return FALSE');

View File

@@ -87,7 +87,7 @@ trait WithdrawalValidation
// if there's an ID it must be of the "validTypes".
if (null !== $accountId && 0 !== $accountId) {
$found = $this->accountRepository->findNull($accountId);
$found = $this->accountRepository->find($accountId);
if (null !== $found) {
$type = $found->accountType->type;
if (in_array($type, $validTypes, true)) {

View File

@@ -228,7 +228,7 @@ class AccountValidator
{
// find by ID
if ($accountId > 0) {
$first = $this->accountRepository->findNull($accountId);
$first = $this->accountRepository->find($accountId);
if ((null !== $first) && in_array($first->accountType->type, $validTypes, true)) {
return $first;
}