Move CRUD method count() to account repository

This commit is contained in:
James Cole
2016-10-09 08:18:47 +02:00
parent 3f40751a1a
commit 1d2d3523d6
6 changed files with 27 additions and 23 deletions

View File

@@ -50,6 +50,20 @@ class AccountRepository implements AccountRepositoryInterface
$this->user = $user;
}
/**
* Moved here from account CRUD
*
* @param array $types
*
* @return int
*/
public function count(array $types):int
{
$count = $this->user->accounts()->accountTypeIn($types)->count();
return $count;
}
/**
* This method will call AccountRepositoryInterface::journalsInPeriod and get all withdrawaks made from the given $accounts,
* as well as the transfers that move away from those $accounts. This is a slightly sharper selection