Extended the validator and created more code to handle exceptions.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-08-10 18:49:16 +02:00
parent c9bd72337d
commit 200366f5be
13 changed files with 510 additions and 71 deletions

View File

@@ -275,6 +275,24 @@ class AccountCrud implements AccountCrudInterface
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->account_type_id = $type->id;
$account->save();
}
return $account;
}
/**
* @param array $data
*

View File

@@ -37,6 +37,14 @@ interface AccountCrudInterface
*/
public function find(int $accountId): Account;
/**
* @param string $number
* @param array $types
*
* @return Account
*/
public function findByAccountNumber(string $number, array $types): Account;
/**
* @param string $iban
* @param array $types
@@ -53,14 +61,6 @@ interface AccountCrudInterface
*/
public function findByName(string $name, array $types): Account;
/**
* @param string $number
* @param array $types
*
* @return Account
*/
public function findByAccountNumber(string $number, array $types): Account;
/**
* @param array $accountIds
*
@@ -91,7 +91,6 @@ interface AccountCrudInterface
*/
public function storeMeta(Account $account, string $name, $value): AccountMeta;
/**
* @param Account $account
* @param array $data
@@ -99,4 +98,12 @@ interface AccountCrudInterface
* @return 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;
}