Moved getAccountsByType

This commit is contained in:
James Cole
2016-10-10 07:49:39 +02:00
parent e8a095e543
commit de6f838413
25 changed files with 215 additions and 202 deletions

View File

@@ -202,6 +202,29 @@ class AccountRepository implements AccountRepositoryInterface
return $result;
}
/**
* @param array $types
*
* @return Collection
*/
public function getAccountsByType(array $types): Collection
{
/** @var Collection $result */
$query = $this->user->accounts();
if (count($types) > 0) {
$query->accountTypeIn($types);
}
$result = $query->get(['accounts.*']);
$result = $result->sortBy(
function (Account $account) {
return strtolower($account->name);
}
);
return $result;
}
/**
* Returns the date of the very first transaction in this account.
*

View File

@@ -34,21 +34,6 @@ interface AccountRepositoryInterface
*/
public function count(array $types): int;
/**
* @param array $accountIds
*
* @return Collection
*/
public function getAccountsById(array $accountIds): Collection;
/**
* @param string $name
* @param array $types
*
* @return Account
*/
public function findByName(string $name, array $types): Account;
/**
* Moved here from account CRUD.
*
@@ -82,6 +67,28 @@ interface AccountRepositoryInterface
*/
public function findByIban(string $iban, array $types): Account;
/**
* @param string $name
* @param array $types
*
* @return Account
*/
public function findByName(string $name, array $types): Account;
/**
* @param array $accountIds
*
* @return Collection
*/
public function getAccountsById(array $accountIds): Collection;
/**
* @param array $types
*
* @return Collection
*/
public function getAccountsByType(array $types): Collection;
/**
* Returns the date of the very first transaction in this account.
*

View File

@@ -62,6 +62,15 @@ interface AccountTaskerInterface
*/
public function expenseReport(Collection $accounts, Collection $excluded, Carbon $start, Carbon $end): Collection;
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return AccountCollection
*/
public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts): AccountCollection;
/**
* Experimental getJournals method.
*
@@ -74,15 +83,6 @@ interface AccountTaskerInterface
*/
public function getJournalsInPeriod(Collection $accounts, array $types, Carbon $start, Carbon $end): Collection;
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return AccountCollection
*/
public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts): AccountCollection;
/**
* @param Collection $accounts
* @param Collection $excluded