@@ 21-65 (lines=45) @@ | ||
18 | use Zend\ServiceManager\FactoryInterface; |
|
19 | use Zend\ServiceManager\ServiceLocatorInterface; |
|
20 | ||
21 | class ForgotPasswordFactory implements FactoryInterface |
|
22 | { |
|
23 | /** |
|
24 | * Create an object |
|
25 | * |
|
26 | * @param ContainerInterface $container |
|
27 | * @param string $requestedName |
|
28 | * @param null|array $options |
|
29 | * |
|
30 | * @return ForgotPassword |
|
31 | * @throws ServiceNotFoundException if unable to resolve the service. |
|
32 | * @throws ServiceNotCreatedException if an exception is raised when |
|
33 | * creating a service. |
|
34 | * @throws ContainerException if any other error occurs |
|
35 | */ |
|
36 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
37 | { |
|
38 | /** |
|
39 | * @var Repository\User $userRepository |
|
40 | * @var UserUniqueTokenGenerator $tokenGenerator |
|
41 | */ |
|
42 | $userRepository = $container->get('repositories')->get('Auth/User'); |
|
43 | $tokenGenerator = $container->get('Auth\Service\UserUniqueTokenGenerator'); |
|
44 | $loginFilter = $container->get('Auth\LoginFilter'); |
|
45 | $config = $container->get('Auth/Options'); |
|
46 | ||
47 | $service = new ForgotPassword($userRepository, $tokenGenerator, $loginFilter, $config); |
|
48 | ||
49 | $events = $container->get('Auth/Events'); |
|
50 | $service->setEventManager($events); |
|
51 | ||
52 | return $service; |
|
53 | } |
|
54 | /** |
|
55 | * Create service |
|
56 | * |
|
57 | * @param ServiceLocatorInterface $serviceLocator |
|
58 | * |
|
59 | * @return ForgotPassword |
|
60 | */ |
|
61 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
62 | { |
|
63 | return $this($serviceLocator, ForgotPassword::class); |
|
64 | } |
|
65 | } |
|
66 |
@@ 26-57 (lines=32) @@ | ||
23 | * @author Mathias Gelhausen <[email protected]> |
|
24 | * @since 0.30 |
|
25 | */ |
|
26 | class ActiveOrganizationsPaginatorFactory implements FactoryInterface |
|
27 | { |
|
28 | ||
29 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
30 | { |
|
31 | /* @var RepositoryService $repositories |
|
32 | * @var \Zend\Http\PhpEnvironment\Request $request */ |
|
33 | $repositories = $container->get('repositories'); |
|
34 | $repository = $repositories->get('Jobs'); |
|
35 | $request = $container->get('Request'); |
|
36 | $query = $request->getQuery(); |
|
37 | $term = $query->get('q'); |
|
38 | $cursor = $repository->findActiveOrganizations($term); |
|
39 | ||
40 | $adapter = new \Core\Paginator\Adapter\DoctrineMongoCursor($cursor); |
|
41 | $service = new Paginator($adapter); |
|
42 | ||
43 | return $service; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Create service |
|
48 | * |
|
49 | * @param ServiceLocatorInterface|AbstractPluginManager $serviceLocator |
|
50 | * |
|
51 | * @return mixed |
|
52 | */ |
|
53 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
54 | { |
|
55 | return $this($serviceLocator->getServiceLocator(), 'Jobs\Paginator\ActiveOrganizations'); |
|
56 | } |
|
57 | } |