Removed some unused code.

This commit is contained in:
James Cole
2016-10-07 16:33:17 +02:00
parent 39dab4fdd9
commit d43936155c
3 changed files with 4 additions and 36 deletions

View File

@@ -119,7 +119,7 @@ class AccountCrud implements AccountCrudInterface
*/ */
public function findByIban(string $iban, array $types): Account public function findByIban(string $iban, array $types): Account
{ {
$query = $this->user->accounts()->where('iban', '!=', ''); $query = $this->user->accounts()->where('iban', '!=', '')->whereNotNull('iban');
if (count($types) > 0) { if (count($types) > 0) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
@@ -176,11 +176,7 @@ class AccountCrud implements AccountCrudInterface
public function getAccountsById(array $accountIds): Collection public function getAccountsById(array $accountIds): Collection
{ {
/** @var Collection $result */ /** @var Collection $result */
$query = $this->user->accounts()->with( $query = $this->user->accounts();
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
);
if (count($accountIds) > 0) { if (count($accountIds) > 0) {
$query->whereIn('accounts.id', $accountIds); $query->whereIn('accounts.id', $accountIds);
@@ -204,11 +200,7 @@ class AccountCrud implements AccountCrudInterface
public function getAccountsByType(array $types): Collection public function getAccountsByType(array $types): Collection
{ {
/** @var Collection $result */ /** @var Collection $result */
$query = $this->user->accounts()->with( $query = $this->user->accounts();
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
);
if (count($types) > 0) { if (count($types) > 0) {
$query->accountTypeIn($types); $query->accountTypeIn($types);
} }
@@ -303,24 +295,6 @@ class AccountCrud implements AccountCrudInterface
return $account; return $account;
} }
/**
* @param Account $account
* @param string $type
*
* @return Account
*/
public function updateAccountType(Account $account, string $type): Account
{
$type = AccountType::whereType($type)->first();
if (!is_null($type)) {
$account->accountType()->associate($type);
$account->save();
}
return $this->find($account->id);
}
/** /**
* @param array $data * @param array $data
* *

View File

@@ -108,11 +108,4 @@ interface AccountCrudInterface
*/ */
public function update(Account $account, array $data): Account; public function update(Account $account, array $data): Account;
/**
* @param Account $account
* @param string $type
*
* @return Account
*/
public function updateAccountType(Account $account, string $type): Account;
} }

View File

@@ -62,6 +62,7 @@ class TransactionController extends Controller
*/ */
public function create(string $what = TransactionType::DEPOSIT) public function create(string $what = TransactionType::DEPOSIT)
{ {
/** @var AccountCrudInterface $crud */
$crud = app(AccountCrudInterface::class); $crud = app(AccountCrudInterface::class);
$budgetRepository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); $budgetRepository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$piggyRepository = app('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface'); $piggyRepository = app('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');