|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @license MIT |
|
7
|
|
|
* @copyright 2013 - 2016 Cross Solution <http://cross-solution.de> |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** */ |
|
11
|
|
|
namespace Organizations\Factory\Controller\Plugin; |
|
12
|
|
|
|
|
13
|
|
|
use Interop\Container\ContainerInterface; |
|
14
|
|
|
use Organizations\Controller\Plugin\InvitationHandler; |
|
15
|
|
|
use Zend\ServiceManager\FactoryInterface; |
|
16
|
|
|
use Zend\ServiceManager\ServiceLocatorInterface; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Factory for an InvitationHandler. |
|
20
|
|
|
* |
|
21
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
22
|
|
|
* @author Anthonius Munthi <[email protected]> |
|
23
|
|
|
* @since 0.19 |
|
24
|
|
|
*/ |
|
25
|
|
|
class InvitationHandlerFactory implements FactoryInterface |
|
26
|
|
|
{ |
|
27
|
|
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
28
|
|
|
{ |
|
29
|
|
|
/* @var $container \Zend\Mvc\Controller\PluginManager */ |
|
30
|
|
|
$services = $container->getServiceLocator(); |
|
31
|
|
|
$validator = $services->get('ValidatorManager')->get('EmailAddress'); |
|
32
|
|
|
$mailer = $container->get('Mailer'); |
|
33
|
|
|
$translator = $services->get('translator'); |
|
34
|
|
|
$repository = $services->get('repositories')->get('Auth/User'); |
|
35
|
|
|
$generator = $services->get('Auth/UserTokenGenerator'); |
|
36
|
|
|
|
|
37
|
|
|
$plugin = new InvitationHandler(); |
|
38
|
|
|
$plugin->setEmailValidator($validator) |
|
39
|
|
|
->setMailerPlugin($mailer) |
|
|
|
|
|
|
40
|
|
|
->setTranslator($translator) |
|
|
|
|
|
|
41
|
|
|
->setUserRepository($repository) |
|
42
|
|
|
->setUserTokenGenerator($generator); |
|
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
return $plugin; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Creates an InvitationHandler |
|
49
|
|
|
* |
|
50
|
|
|
* @param ServiceLocatorInterface $serviceLocator |
|
51
|
|
|
* |
|
52
|
|
|
* @return InvitationHandler |
|
53
|
|
|
*/ |
|
54
|
|
|
public function createService(ServiceLocatorInterface $serviceLocator) |
|
55
|
|
|
{ |
|
56
|
|
|
return $this($serviceLocator,InvitationHandler::class); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: