Small extension on import account, for testing mostly.

This commit is contained in:
James Cole
2018-01-06 09:33:28 +01:00
parent af1bdc0c2c
commit 76d8017be5
4 changed files with 217 additions and 24 deletions

View File

@@ -87,6 +87,18 @@ class AccountRepository implements AccountRepositoryInterface
return true;
}
/**
* Return account type by string.
*
* @param string $type
*
* @return AccountType|null
*/
public function getAccountType(string $type): ?AccountType
{
return AccountType::whereType($type)->first();
}
/**
* @param Account $account
*

View File

@@ -24,6 +24,7 @@ namespace FireflyIII\Repositories\Account;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\User;
@@ -34,12 +35,6 @@ use Illuminate\Support\Collection;
*/
interface AccountRepositoryInterface
{
/**
* @param Account $account
*
* @return Note|null
*/
public function getNote(Account $account): ?Note;
/**
* Moved here from account CRUD.
*
@@ -90,6 +85,15 @@ interface AccountRepositoryInterface
*/
public function findByName(string $name, array $types): Account;
/**
* Return account type by string.
*
* @param string $type
*
* @return AccountType|null
*/
public function getAccountType(string $type): ?AccountType;
/**
* @param array $accountIds
*
@@ -116,6 +120,13 @@ interface AccountRepositoryInterface
*/
public function getCashAccount(): Account;
/**
* @param Account $account
*
* @return Note|null
*/
public function getNote(Account $account): ?Note;
/**
* Find or create the opposing reconciliation account.
*