| @@ 18-42 (lines=25) @@ | ||
| 15 | use Zend\ServiceManager\FactoryInterface; |
|
| 16 | use Zend\ServiceManager\ServiceLocatorInterface; |
|
| 17 | ||
| 18 | class JobboardControllerFactory implements FactoryInterface |
|
| 19 | { |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Injects all needed services into the JobboardController |
|
| 23 | * |
|
| 24 | * @param ServiceLocatorInterface $serviceLocator |
|
| 25 | * |
|
| 26 | * @return JobboardController |
|
| 27 | */ |
|
| 28 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
| 29 | { |
|
| 30 | /** @var ControllerManager $serviceLocator */ |
|
| 31 | $serviceLocator = $serviceLocator->getServiceLocator(); |
|
| 32 | ||
| 33 | $searchForm = $serviceLocator->get('forms')->get('Jobs/ListFilter', /* useAcl */ false); |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @var $jobRepository Repository\Job |
|
| 37 | */ |
|
| 38 | $jobRepository = $serviceLocator->get('repositories')->get('Jobs/Job'); |
|
| 39 | ||
| 40 | return new JobboardController($jobRepository, $searchForm); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 18-41 (lines=24) @@ | ||
| 15 | use Zend\ServiceManager\FactoryInterface; |
|
| 16 | use Zend\ServiceManager\ServiceLocatorInterface; |
|
| 17 | ||
| 18 | class TemplateControllerFactory implements FactoryInterface |
|
| 19 | { |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Injects all needed services into the TemplateController |
|
| 23 | * |
|
| 24 | * @param ServiceLocatorInterface $serviceLocator |
|
| 25 | * |
|
| 26 | * @return TemplateController |
|
| 27 | */ |
|
| 28 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
| 29 | { |
|
| 30 | /** @var ControllerManager $serviceLocator */ |
|
| 31 | $serviceLocator = $serviceLocator->getServiceLocator(); |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @var $jobRepository Repository\Job |
|
| 35 | */ |
|
| 36 | $jobRepository = $serviceLocator->get('repositories')->get('Jobs/Job'); |
|
| 37 | $options = $serviceLocator->get('Jobs/Options'); |
|
| 38 | ||
| 39 | return new TemplateController($jobRepository, $options); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 18-42 (lines=25) @@ | ||
| 15 | use Zend\ServiceManager\FactoryInterface; |
|
| 16 | use Zend\ServiceManager\ServiceLocatorInterface; |
|
| 17 | ||
| 18 | class IndexControllerFactory implements FactoryInterface |
|
| 19 | { |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Injects all needed services into the IndexController |
|
| 23 | * |
|
| 24 | * @param ServiceLocatorInterface $serviceLocator |
|
| 25 | * |
|
| 26 | * @return JobboardController |
|
| 27 | */ |
|
| 28 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
| 29 | { |
|
| 30 | /** @var ControllerManager $serviceLocator */ |
|
| 31 | $serviceLocator = $serviceLocator->getServiceLocator(); |
|
| 32 | ||
| 33 | $searchForm = $serviceLocator->get('forms')->get('Jobs/ListFilter', /* useAcl */ true); |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @var $jobRepository Repository\Job |
|
| 37 | */ |
|
| 38 | $jobRepository = $serviceLocator->get('repositories')->get('Jobs/Job'); |
|
| 39 | ||
| 40 | return new IndexController($jobRepository, $searchForm); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||