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

namespace UnicaenLdap\Service;

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

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

    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
22
23
24
    {
        $service = new People();

25
26
27
28
29
30
        /** @var \UnicaenLdap\Ldap $ldap */
        $ldap = $container->get('ldap');

        $service->setLdap($ldap);

        $service->setLdapServicesByEntityClass([
31
//            \UnicaenLdap\Entity\People::class    => $container->get('ldapServicePeople'),
32
33
34
35
36
            \UnicaenLdap\Entity\Structure::class => $container->get('ldapServiceStructure'),
            \UnicaenLdap\Entity\System::class    => $container->get('ldapServiceSystem'),
            \UnicaenLdap\Entity\Group::class     => $container->get('ldapServiceGroup'),
            \UnicaenLdap\Entity\Generic::class   => $container->get('ldapServiceGeneric'),
        ]);
37
38
39
40

        return $service;
    }
}