Loading config/module.config.php +11 −12 Original line number Diff line number Diff line Loading @@ -2,27 +2,26 @@ use UnicaenLdap\LdapFactory; use UnicaenLdap\Options\ModuleOptionsFactory; use UnicaenLdap\Service\Generic as GenericService; use UnicaenLdap\Service\Group as GroupService; use UnicaenLdap\Service\People as PeopleService; use UnicaenLdap\Service\Structure as StructureService; use UnicaenLdap\Service\System as SystemService; use UnicaenLdap\Service\GenericFactory as GenericServiceFactory; use UnicaenLdap\Service\GroupFactory as GroupServiceFactory; use UnicaenLdap\Service\PeopleFactory as PeopleServiceFactory; use UnicaenLdap\Service\StructureFactory as StructureServiceFactory; use UnicaenLdap\Service\SystemFactory as SystemServiceFactory; return array( 'unicaen-ldap' => [ ], 'service_manager' => [ 'invokables' => [ 'LdapServiceGeneric' => GenericService::class, 'LdapServiceGroup' => GroupService::class, 'LdapServicePeople' => PeopleService::class, 'LdapServiceStructure' => StructureService::class, 'LdapServiceSystem' => SystemService::class, ], 'factories' => [ 'Ldap' => LdapFactory::class, 'LdapOptions' => ModuleOptionsFactory::class, 'LdapServiceGeneric' => GenericServiceFactory::class, 'LdapServiceGroup' => GroupServiceFactory::class, 'LdapServicePeople' => PeopleServiceFactory::class, 'LdapServiceStructure' => StructureServiceFactory::class, 'LdapServiceSystem' => SystemServiceFactory::class, ], ], ); src/UnicaenLdap/Entity/Group.php +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class Group extends Entity public function getPeople($orderBy = null) { /* @var $people \UnicaenLdap\Service\People */ $people = $this->getService()->getServiceManager()->get('ldapServicePeople'); $people = $this->getService()->getServiceLocator()->get('ldapServicePeople'); /** @var People[] $result */ $result = $people->getAllBy($this->get('member'), 'dn', $orderBy); Loading src/UnicaenLdap/Entity/People.php +6 −6 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ class People extends Entity */ public function getGroups(DateTime $dateObservation = null, $orderBy = null) { $group = $this->getService()->getServiceManager()->get('ldapServiceGroup'); $group = $this->getService()->getServiceLocator()->get('ldapServiceGroup'); return $group->filterValids($group->getAllBy($this->get('memberOf'), 'dn', $orderBy), $dateObservation); } Loading Loading @@ -175,7 +175,7 @@ class People extends Entity */ public function getEduPersonOrgUnit() { $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $dn = $this->eduPersonOrgUnitDN; if (empty($dn)) return null; Loading @@ -189,7 +189,7 @@ class People extends Entity */ public function getEduPersonPrimaryOrgUnit() { $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $dn = $this->eduPersonPrimaryOrgUnitDN; if (empty($dn)) return null; Loading @@ -206,7 +206,7 @@ class People extends Entity public function getEntiteAffectation() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $codes = $this->getNode()->getAttribute('supannEntiteAffectation'); var_dump($codes); Loading @@ -223,7 +223,7 @@ class People extends Entity public function getEntiteAffectationPrincipale() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $codes = []; $affectations = $this->getNode()->getAttribute('supannAffectation'); Loading @@ -246,7 +246,7 @@ class People extends Entity public function getAffectationDescription() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); list($code, $description) = explode(';', $this->supannAffectation); $code = $this->supannAffectation; Loading src/UnicaenLdap/Service/AbstractService.php +5 −29 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use UnicaenLdap\Entity\Entity; use UnicaenLdap\Exception; use UnicaenLdap\Collection; use UnicaenLdap\Filter\Filter; use Zend\ServiceManager\ServiceLocatorAwareTrait; use Zend\ServiceManager\ServiceManager; use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\Ldap\Filter\AbstractFilter; Loading @@ -18,8 +19,10 @@ use Zend\Stdlib\ErrorHandler; * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ abstract class AbstractService implements ServiceManagerAwareInterface abstract class AbstractService { use ServiceLocatorAwareTrait; /** * Limite de recherche par défaut */ Loading @@ -30,11 +33,6 @@ abstract class AbstractService implements ServiceManagerAwareInterface */ const DEFAULT_OFFSET = 0; /** * @var ServiceManager */ protected $serviceManager; /** * @var Ldap */ Loading @@ -59,28 +57,6 @@ abstract class AbstractService implements ServiceManagerAwareInterface */ protected $count; /** * Get service manager * * @return ServiceManager */ public function getServiceManager() { return $this->serviceManager; } /** * Set service manager * * @param ServiceManager $serviceManager * @return AbstractService */ public function setServiceManager(ServiceManager $serviceManager) { $this->serviceManager = $serviceManager; return $this; } /** * Retourne le type du service * Loading @@ -99,7 +75,7 @@ abstract class AbstractService implements ServiceManagerAwareInterface public function getLdap() { if (empty($this->ldap)){ $this->ldap = $this->getServiceManager()->get('ldap'); $this->ldap = $this->getServiceLocator()->get('ldap'); } return $this->ldap; } Loading src/UnicaenLdap/Service/GenericFactory.php 0 → 100644 +29 −0 Original line number Diff line number Diff line <?php namespace UnicaenLdap\Service; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; /** * * * @author Unicaen */ class GenericFactory implements FactoryInterface { /** * Create service * * @param ServiceLocatorInterface $serviceLocator * @return Generic */ public function createService(ServiceLocatorInterface $serviceLocator) { $service = new Generic(); $service->setServiceLocator($serviceLocator); return $service; } } Loading
config/module.config.php +11 −12 Original line number Diff line number Diff line Loading @@ -2,27 +2,26 @@ use UnicaenLdap\LdapFactory; use UnicaenLdap\Options\ModuleOptionsFactory; use UnicaenLdap\Service\Generic as GenericService; use UnicaenLdap\Service\Group as GroupService; use UnicaenLdap\Service\People as PeopleService; use UnicaenLdap\Service\Structure as StructureService; use UnicaenLdap\Service\System as SystemService; use UnicaenLdap\Service\GenericFactory as GenericServiceFactory; use UnicaenLdap\Service\GroupFactory as GroupServiceFactory; use UnicaenLdap\Service\PeopleFactory as PeopleServiceFactory; use UnicaenLdap\Service\StructureFactory as StructureServiceFactory; use UnicaenLdap\Service\SystemFactory as SystemServiceFactory; return array( 'unicaen-ldap' => [ ], 'service_manager' => [ 'invokables' => [ 'LdapServiceGeneric' => GenericService::class, 'LdapServiceGroup' => GroupService::class, 'LdapServicePeople' => PeopleService::class, 'LdapServiceStructure' => StructureService::class, 'LdapServiceSystem' => SystemService::class, ], 'factories' => [ 'Ldap' => LdapFactory::class, 'LdapOptions' => ModuleOptionsFactory::class, 'LdapServiceGeneric' => GenericServiceFactory::class, 'LdapServiceGroup' => GroupServiceFactory::class, 'LdapServicePeople' => PeopleServiceFactory::class, 'LdapServiceStructure' => StructureServiceFactory::class, 'LdapServiceSystem' => SystemServiceFactory::class, ], ], );
src/UnicaenLdap/Entity/Group.php +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class Group extends Entity public function getPeople($orderBy = null) { /* @var $people \UnicaenLdap\Service\People */ $people = $this->getService()->getServiceManager()->get('ldapServicePeople'); $people = $this->getService()->getServiceLocator()->get('ldapServicePeople'); /** @var People[] $result */ $result = $people->getAllBy($this->get('member'), 'dn', $orderBy); Loading
src/UnicaenLdap/Entity/People.php +6 −6 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ class People extends Entity */ public function getGroups(DateTime $dateObservation = null, $orderBy = null) { $group = $this->getService()->getServiceManager()->get('ldapServiceGroup'); $group = $this->getService()->getServiceLocator()->get('ldapServiceGroup'); return $group->filterValids($group->getAllBy($this->get('memberOf'), 'dn', $orderBy), $dateObservation); } Loading Loading @@ -175,7 +175,7 @@ class People extends Entity */ public function getEduPersonOrgUnit() { $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $dn = $this->eduPersonOrgUnitDN; if (empty($dn)) return null; Loading @@ -189,7 +189,7 @@ class People extends Entity */ public function getEduPersonPrimaryOrgUnit() { $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $dn = $this->eduPersonPrimaryOrgUnitDN; if (empty($dn)) return null; Loading @@ -206,7 +206,7 @@ class People extends Entity public function getEntiteAffectation() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $codes = $this->getNode()->getAttribute('supannEntiteAffectation'); var_dump($codes); Loading @@ -223,7 +223,7 @@ class People extends Entity public function getEntiteAffectationPrincipale() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); $codes = []; $affectations = $this->getNode()->getAttribute('supannAffectation'); Loading @@ -246,7 +246,7 @@ class People extends Entity public function getAffectationDescription() { throw new \Exception('Méthode pas finie'); $structure = $this->getService()->getServiceManager()->get('ldapServiceStructure'); $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure'); list($code, $description) = explode(';', $this->supannAffectation); $code = $this->supannAffectation; Loading
src/UnicaenLdap/Service/AbstractService.php +5 −29 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use UnicaenLdap\Entity\Entity; use UnicaenLdap\Exception; use UnicaenLdap\Collection; use UnicaenLdap\Filter\Filter; use Zend\ServiceManager\ServiceLocatorAwareTrait; use Zend\ServiceManager\ServiceManager; use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\Ldap\Filter\AbstractFilter; Loading @@ -18,8 +19,10 @@ use Zend\Stdlib\ErrorHandler; * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ abstract class AbstractService implements ServiceManagerAwareInterface abstract class AbstractService { use ServiceLocatorAwareTrait; /** * Limite de recherche par défaut */ Loading @@ -30,11 +33,6 @@ abstract class AbstractService implements ServiceManagerAwareInterface */ const DEFAULT_OFFSET = 0; /** * @var ServiceManager */ protected $serviceManager; /** * @var Ldap */ Loading @@ -59,28 +57,6 @@ abstract class AbstractService implements ServiceManagerAwareInterface */ protected $count; /** * Get service manager * * @return ServiceManager */ public function getServiceManager() { return $this->serviceManager; } /** * Set service manager * * @param ServiceManager $serviceManager * @return AbstractService */ public function setServiceManager(ServiceManager $serviceManager) { $this->serviceManager = $serviceManager; return $this; } /** * Retourne le type du service * Loading @@ -99,7 +75,7 @@ abstract class AbstractService implements ServiceManagerAwareInterface public function getLdap() { if (empty($this->ldap)){ $this->ldap = $this->getServiceManager()->get('ldap'); $this->ldap = $this->getServiceLocator()->get('ldap'); } return $this->ldap; } Loading
src/UnicaenLdap/Service/GenericFactory.php 0 → 100644 +29 −0 Original line number Diff line number Diff line <?php namespace UnicaenLdap\Service; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; /** * * * @author Unicaen */ class GenericFactory implements FactoryInterface { /** * Create service * * @param ServiceLocatorInterface $serviceLocator * @return Generic */ public function createService(ServiceLocatorInterface $serviceLocator) { $service = new Generic(); $service->setServiceLocator($serviceLocator); return $service; } }