| @@ 24-62 (lines=39) @@ | ||
| 21 | use Surfnet\StepupMiddleware\ApiBundle\Identity\Query\RaCandidateQuery; |
|
| 22 | use Surfnet\StepupMiddleware\ApiBundle\Identity\Repository\RaCandidateRepository; |
|
| 23 | ||
| 24 | class RaCandidateService extends AbstractSearchService |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var RaCandidateRepository |
|
| 28 | */ |
|
| 29 | private $raCandidateRepository; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param RaCandidateRepository $raCandidateRepository |
|
| 33 | */ |
|
| 34 | public function __construct(RaCandidateRepository $raCandidateRepository) |
|
| 35 | { |
|
| 36 | $this->raCandidateRepository = $raCandidateRepository; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @param RaCandidateQuery $query |
|
| 41 | * @return \Pagerfanta\Pagerfanta |
|
| 42 | */ |
|
| 43 | public function search(RaCandidateQuery $query) |
|
| 44 | { |
|
| 45 | $doctrineQuery = $this->raCandidateRepository->createSearchQuery($query); |
|
| 46 | ||
| 47 | $paginator = $this->createPaginatorFrom($doctrineQuery, $query); |
|
| 48 | ||
| 49 | return $paginator; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @param string $identityId |
|
| 54 | * @return null|\Surfnet\StepupMiddleware\ApiBundle\Identity\Entity\RaCandidate |
|
| 55 | */ |
|
| 56 | public function findByIdentityId($identityId) |
|
| 57 | { |
|
| 58 | $raCandidate = $this->raCandidateRepository->findByIdentityId($identityId); |
|
| 59 | ||
| 60 | return $raCandidate; |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 24-60 (lines=37) @@ | ||
| 21 | use Surfnet\StepupMiddleware\ApiBundle\Identity\Query\RaSecondFactorQuery; |
|
| 22 | use Surfnet\StepupMiddleware\ApiBundle\Identity\Repository\RaSecondFactorRepository; |
|
| 23 | ||
| 24 | class RaSecondFactorService extends AbstractSearchService |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var \Surfnet\StepupMiddleware\ApiBundle\Identity\Repository\RaSecondFactorRepository |
|
| 28 | */ |
|
| 29 | private $repository; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param RaSecondFactorRepository $repository |
|
| 33 | */ |
|
| 34 | public function __construct(RaSecondFactorRepository $repository) |
|
| 35 | { |
|
| 36 | $this->repository = $repository; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @param RaSecondFactorQuery $query |
|
| 41 | * @return \Pagerfanta\Pagerfanta |
|
| 42 | */ |
|
| 43 | public function search(RaSecondFactorQuery $query) |
|
| 44 | { |
|
| 45 | $doctrineQuery = $this->repository->createSearchQuery($query); |
|
| 46 | ||
| 47 | $paginator = $this->createPaginatorFrom($doctrineQuery, $query); |
|
| 48 | ||
| 49 | return $paginator; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @param RaSecondFactorQuery $query |
|
| 54 | * @return array |
|
| 55 | */ |
|
| 56 | public function searchUnpaginated(RaSecondFactorQuery $query) |
|
| 57 | { |
|
| 58 | return $this->repository->createSearchQuery($query)->getResult(); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||