Skip to content

Commit

Permalink
Merge 9044483 into 12d22a6
Browse files Browse the repository at this point in the history
  • Loading branch information
kilip committed Mar 19, 2017
2 parents 12d22a6 + 9044483 commit afd23bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion module/Core/src/Core/Factory/OptionsAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Creates options instances from configuration specifications.
*
* @author Mathias Gelhausen <gelhausen@cross-solution.de>
* @author Anthonius Munthi <me@itstoni.com>
* @since 0.23
*/
class OptionsAbstractFactory implements AbstractFactoryInterface
Expand Down Expand Up @@ -174,7 +175,6 @@ protected function createNestedOptions($className, $options)
* Returns FALSE if configuration cannot be found.
*
* @param string $fullName
* @param string $normalizedName
*
* @return array|bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/** */
namespace Organizations\Factory\Controller\Plugin;

use Interop\Container\ContainerInterface;
use Organizations\Controller\Plugin\InvitationHandler;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
Expand All @@ -18,34 +19,40 @@
* Factory for an InvitationHandler.
*
* @author Mathias Gelhausen <gelhausen@cross-solution.de>
* @author Anthonius Munthi <me@itstoni.com>
* @since 0.19
*/
class InvitationHandlerFactory implements FactoryInterface
{
/**
* Creates an InvitationHandler
*
* @param ServiceLocatorInterface $serviceLocator
*
* @return InvitationHandler
*/
public function createService(ServiceLocatorInterface $serviceLocator)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
/* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
$services = $serviceLocator->getServiceLocator();
/* @var $container \Zend\Mvc\Controller\PluginManager */
$services = $container->getServiceLocator();
$validator = $services->get('ValidatorManager')->get('EmailAddress');
$mailer = $serviceLocator->get('Mailer');
$mailer = $container->get('Mailer');
$translator = $services->get('translator');
$repository = $services->get('repositories')->get('Auth/User');
$generator = $services->get('Auth/UserTokenGenerator');

$plugin = new InvitationHandler();
$plugin->setEmailValidator($validator)
->setMailerPlugin($mailer)
->setTranslator($translator)
->setUserRepository($repository)
->setUserTokenGenerator($generator);
->setMailerPlugin($mailer)
->setTranslator($translator)
->setUserRepository($repository)
->setUserTokenGenerator($generator);

return $plugin;
}

/**
* Creates an InvitationHandler
*
* @param ServiceLocatorInterface $serviceLocator
*
* @return InvitationHandler
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this($serviceLocator,InvitationHandler::class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
namespace Organizations\Mail;

use Auth\Entity\UserInterface;
use Core\Mail\HTMLTemplateMessage;
use Interop\Container\ContainerInterface;
use Organizations\ImageFileCache\ODMListener;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\MutableCreationOptionsInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
Expand All @@ -20,6 +22,7 @@
* This Factory creates and configures the HTMLTemplateMail send to an invited person.
*
* @author Mathias Gelhausen <gelhausen@cross-solution.de>
* @author Anthonius Munthi <me@itstoni.com>
* @since 0.19
*/
class EmployeeInvitationFactory implements FactoryInterface, MutableCreationOptionsInterface
Expand All @@ -37,6 +40,7 @@ class EmployeeInvitationFactory implements FactoryInterface, MutableCreationOpti
* @param ContainerInterface $container
* @param string $requestedName
* @param null|array $options
* @TODO fix method description, this method is not used to create an ODMListener but it will configure HTMLTemplateMail
*
* @return ODMListener
*/
Expand Down Expand Up @@ -121,8 +125,6 @@ public function setCreationOptions(array $options)
$this->options = $options;
}



/**
* Create service
*
Expand All @@ -133,7 +135,6 @@ public function setCreationOptions(array $options)
public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var $serviceLocator \Core\Mail\MailService */
return $this($serviceLocator->getServiceLocator(), ODMListener::class);

return $this($serviceLocator->getServiceLocator(), HTMLTemplateMessage::class);
}
}

0 comments on commit afd23bf

Please sign in to comment.