Select Git revision
GenericFactory.php
-
David Surville authoredDavid Surville authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
GenericFactory.php 1.60 KiB
<?php
namespace UnicaenLdap\Service;
use Interop\Container\ContainerInterface;
use UnicaenLdap\Ldap;
use UnicaenLdap\Service;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class GenericFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
{
return $this->__invoke($serviceLocator, '?');
}
/**
* Create service
*
* @param ContainerInterface $container
* @param string $requestedName
* @param array|null $options
* @return object|Generic
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
/**
* @var Ldap $ldap
* @var Service\People $ldapPeopleService
* @var Service\Structure $ldapStructureService
* @var Service\Group $ldapGroupService
* @var Service\System $ldapSystemService
*/
$ldap = $container->get('ldap');
$ldapPeopleService = $container->get('ldapServicePeople');
$ldapStructureService = $container->get('ldapServiceStructure');
$ldapGroupService = $container->get('ldapServiceGroup');
$ldapSystemService = $container->get('ldapServiceSystem');
$service = new Generic();
$service->setLdap($ldap);
$service->setLdapPeopleService($ldapPeopleService);
$service->setLdapStructureService($ldapStructureService);
$service->setLdapGroupService($ldapGroupService);
$service->setLdapSystemService($ldapSystemService);
return $service;
}
}