PeopleFactory.php 1.64 KB
Newer Older
1
2
3
4
<?php

namespace UnicaenLdap\Service;

5
use Interop\Container\ContainerInterface;
6
7
use UnicaenLdap\Ldap;
use UnicaenLdap\Service;
8
9
10
11
12
13
14
15
16
17
18
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 *
 *
 * @author Unicaen
 */
class PeopleFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
19
20
21
22
    {
        return $this->__invoke($serviceLocator, '?');
    }

23
24
25
26
27
28
29
30
    /**
     * Create service
     *
     * @param ContainerInterface $container
     * @param string $requestedName
     * @param array|null $options
     * @return object|People
     */
31
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
32
    {
33
34
35
36
37
38
39
        /**
         * @var Ldap $ldap
         * @var Service\Structure $ldapStructureService
         * @var Service\Group $ldapGroupService
         * @var Service\System $ldapSystemService
         * @var Service\Generic $ldapGenericService
         */
40
        $ldap = $container->get('ldap');
41
42
43
44
        $ldapStructureService   = $container->get('ldapServiceStructure');
        $ldapGroupService       = $container->get('ldapServiceGroup');
        $ldapSystemService      = $container->get('ldapServiceSystem');
        $ldapGenericService     = $container->get('ldapServiceGeneric');
45

46
        $service = new People();
47
        $service->setLdap($ldap);
48
49
50
51
        $service->setLdapStructureService($ldapStructureService);
        $service->setLdapGroupService($ldapGroupService);
        $service->setLdapSystemService($ldapSystemService);
        $service->setLdapGenericService($ldapGenericService);
52
53
54
55

        return $service;
    }
}