Commit e8fe4a66 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Corrections pour passer à ZF3.

parent dc4411a6
......@@ -2,6 +2,7 @@
namespace UnicaenLdap;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,16 +13,15 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class LdapFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Ldap
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
/* @var $options \UnicaenLdap\Options\ModuleOptions */
$options = $serviceLocator->get('ldapOptions');
$options = $container->get('ldapOptions');
return new Ldap( $options->getLdap() );
}
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Options;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,15 +13,14 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class ModuleOptionsFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return ModuleOptions
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Configuration');
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('Configuration');
$moduleConfig = isset($config['unicaen-ldap']) ? $config['unicaen-ldap'] : array();
return new ModuleOptions($moduleConfig);
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class GenericFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Generic
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new Generic();
$service->setServiceLocator($serviceLocator);
$service->setServiceLocator($container);
return $service;
}
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class GroupFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Group
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new Group();
$service->setServiceLocator($serviceLocator);
$service->setServiceLocator($container);
return $service;
}
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class PeopleFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return People
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new People();
$service->setServiceLocator($serviceLocator);
$service->setServiceLocator($container);
return $service;
}
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class StructureFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Structure
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new Structure();
$service->setServiceLocator($serviceLocator);
$service->setServiceLocator($container);
return $service;
}
......
......@@ -2,6 +2,7 @@
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
......@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class SystemFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return System
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$service = new System();
$service->setServiceLocator($serviceLocator);
$service->setServiceLocator($container);
return $service;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment