@@ -59,13 +59,18 @@ definition:
59
59
# app/config/services.yml
60
60
services :
61
61
ldap :
62
- class : Symfony\Component\Ldap\LdapClient
62
+ class : ' Symfony\Component\Ldap\Ldap'
63
+ factory : ['Symfony\Component\Ldap\Ldap', 'create']
63
64
arguments :
64
- - my-server # host
65
- - 389 # port
66
- - 3 # version
67
- - false # SSL
68
- - true # TLS
65
+ - ' ext_ldap' # associated adapter - only one currently
66
+ - host : ' 127.0.0.1' # host
67
+ port : ' 389' # port
68
+ version : 3 # version
69
+ encryption : ' none' # either 'tls', 'ssl' or 'none'
70
+ debug : false, # Enable debugging output
71
+ referrals : false # Follow referrals returned by the server
72
+ options : [] # additional PHP LDAP options
73
+ # see http://php.net/manual/en/function.ldap-set-option.php
69
74
70
75
.. code-block :: xml
71
76
@@ -76,31 +81,45 @@ definition:
76
81
xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
77
82
78
83
<services >
79
- <service id =" ldap" class =" Symfony\Component\Ldap\LdapClient" >
80
- <argument >my-server</argument >
81
- <argument >389</argument >
82
- <argument >3</argument >
83
- <argument >false</argument >
84
- <argument >true</argument >
84
+ <service id =" ldap" class =" Symfony\Component\Ldap\Ldap" >
85
+ <factory class =" Symfony\Component\Ldap\Ldap" method =" create" />
86
+ <argument >ext_ldap</argument >
87
+ <argument type =" collection" >
88
+ <argument key =" host" >127.0.0.1</argument >
89
+ <argument key =" port" >389</argument >
90
+ <argument key =" version" >3</argument >
91
+ <argument key =" encryption" >none</argument >
92
+ <argument key =" debug" >false</argument >
93
+ <argument key =" referrals" >false</argument >
94
+ <argument key =" options" type =" collection" ></argument >
95
+ </argument >
85
96
</service >
86
97
</services >
87
98
</container >
88
99
89
100
.. code-block :: php
90
101
91
- // app/config/services.php
92
- use Symfony\Component\Ldap\LdapClient;
102
+ use Symfony\Component\Ldap\Ldap;
93
103
use Symfony\Component\DependencyInjection\Definition;
104
+ // …
105
+
106
+ // app/config/services.php
107
+ $definition = new Definition(Ldap::class, array(
108
+ 'ext_ldap',
109
+ array(
110
+ 'host' => '127.0.0.1'
111
+ 'port' => '389'
112
+ 'version' => 3
113
+ 'encryption' => 'none'
114
+ 'debug' => false,
115
+ 'referrals' => false
116
+ 'options' => array()
117
+ )
118
+ ));
119
+ $definition->setFactory(array(Ldap::class, 'create'));
94
120
95
121
$container
96
- ->setDefinition('ldap', new Definition(LdapClient::class, array(
97
- 'my-server',
98
- 389,
99
- 3,
100
- false,
101
- true,
102
-
103
- ));
122
+ ->setDefinition('ldap', $definition);
104
123
105
124
Fetching Users Using the LDAP User Provider
106
125
-------------------------------------------
0 commit comments