/** * Constructor. * * @param PatientRepositoryInterface $patientRepository * @param DiagnosisRepositoryInterface $diagnosisRepository * @param ActivityRepositoryInterface $activityRepository */ public function __construct(PatientRepositoryInterface $patientRepository, DiagnosisRepositoryInterface $diagnosisRepository, ActivityRepositoryInterface $activityRepository) { $this->patientClass = $patientRepository->getClassName(); $this->patientRepository = $patientRepository; $this->diagnosisClass = $diagnosisRepository->getClassName(); $this->diagnosisRepository = $diagnosisRepository; $this->activityClass = $activityRepository->getClassName(); $this->activityRepository = $activityRepository; }
/** * {@inheritdoc} */ public function getPatientByName($patientName) { try { if (!($patient = $this->repository->getByName($patientName))) { throw new PatientNotFoundException('name', $patientName); } } catch (NonUniqueResultException $exception) { throw new MultiplePatientsFoundException(); } return $patient; }