| @@ 20-49 (lines=30) @@ | ||
| 17 | * |
|
| 18 | * @package OldTown\Workflow\ZF2\Toolkit\EntryToObjects |
|
| 19 | */ |
|
| 20 | class EntryToObjectsServiceFactory implements FactoryInterface |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @param ServiceLocatorInterface $serviceLocator |
|
| 24 | * |
|
| 25 | * @return EntryToObjectsService |
|
| 26 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
| 27 | */ |
|
| 28 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
| 29 | { |
|
| 30 | $appServiceLocator = $serviceLocator; |
|
| 31 | if ($serviceLocator instanceof AbstractPluginManager) { |
|
| 32 | $appServiceLocator = $serviceLocator->getServiceLocator(); |
|
| 33 | } |
|
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | $serializerManager = $appServiceLocator->get('SerializerAdapterManager'); |
|
| 38 | $moduleOptions = $appServiceLocator->get(ModuleOptions::class); |
|
| 39 | $workflowService = $appServiceLocator->get(Workflow::class); |
|
| 40 | ||
| 41 | return new EntryToObjectsService( |
|
| 42 | [ |
|
| 43 | 'serializerManager' => $serializerManager, |
|
| 44 | 'moduleOptions' => $moduleOptions, |
|
| 45 | 'workflowService' => $workflowService |
|
| 46 | ] |
|
| 47 | ); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 20-51 (lines=32) @@ | ||
| 17 | * |
|
| 18 | * @package OldTown\Workflow\ZF2\Toolkit\WorkflowRunParams |
|
| 19 | */ |
|
| 20 | class EntryIdResolverFactory implements FactoryInterface |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @param ServiceLocatorInterface $serviceLocator |
|
| 24 | * |
|
| 25 | * @return EntryIdResolver |
|
| 26 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
| 27 | * @throws \Zend\ServiceManager\Exception\ServiceNotCreatedException |
|
| 28 | * @throws \Zend\ServiceManager\Exception\RuntimeException |
|
| 29 | */ |
|
| 30 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
| 31 | { |
|
| 32 | /** @var WorkflowServiceManager $wfServiceManager */ |
|
| 33 | $wfServiceManager = $serviceLocator->get(WorkflowServiceManager::class); |
|
| 34 | ||
| 35 | /** @var EntryToObjectsService $entryToObjectsService */ |
|
| 36 | $entryToObjectsService = $wfServiceManager->get(EntryToObjectsService::class); |
|
| 37 | $moduleOptions = $serviceLocator->get(ModuleOptions::class); |
|
| 38 | ||
| 39 | /** @var Application $app */ |
|
| 40 | $app = $serviceLocator->get('Application'); |
|
| 41 | $mvcEvent = $app->getMvcEvent(); |
|
| 42 | ||
| 43 | $options = [ |
|
| 44 | 'entryToObjectsService' => $entryToObjectsService, |
|
| 45 | 'moduleOptions' => $moduleOptions, |
|
| 46 | 'mvcEvent' => $mvcEvent |
|
| 47 | ]; |
|
| 48 | ||
| 49 | return new EntryIdResolver($options); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||