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

@@ -89,7 +89,7 @@ class FixFrontpageAccounts extends Command
/** @var string $accountId */
foreach ($data as $accountId) {
$accountIdInt = (int)$accountId;
$account = $repository->findNull($accountIdInt);
$account = $repository->find($accountIdInt);
if (null !== $account
&& in_array($account->accountType->type, [AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE], true)
&& true === $account->active) {

View File

@@ -213,7 +213,7 @@ class ApplyRules extends Command
$accountRepository->setUser($this->getUser());
foreach ($accountList as $accountId) {
$accountId = (int)$accountId;
$account = $accountRepository->findNull($accountId);
$account = $accountRepository->find($accountId);
if (null !== $account && in_array($account->accountType->type, $this->acceptedAccounts, true)) {
$finalList->push($account);
}

View File

@@ -46,7 +46,7 @@ trait VerifiesAccessToken
$userId = (int)$this->option('user');
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$user = $repository->findNull($userId);
$user = $repository->find($userId);
if (null === $user) {
throw new FireflyException('User is unexpectedly NULL');
}
@@ -75,7 +75,7 @@ trait VerifiesAccessToken
$token = (string)$this->option('token');
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$user = $repository->findNull($userId);
$user = $repository->find($userId);
if (null === $user) {
Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));