@@ -137,6 +137,38 @@ delete existing ones::
137
137
// Removing an existing entry
138
138
$entryManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
139
139
140
+
141
+ Batch Updating
142
+ ______________
143
+
144
+ Use the entry manager's :method: `Symfony\\ Component\\ Ldap\\ Adapter\\ ExtLdap\\ EntryManager::applyOperations `
145
+ method to update multiple attributes at once::
146
+
147
+ use Symfony\Component\Ldap\Ldap;
148
+ use Symfony\Component\Ldap\Entry;
149
+ // ...
150
+
151
+ $entry = new Entry('cn=Fabien Potencier,dc=symfony,dc=com', array(
152
+ 'sn' => array('fabpot'),
153
+ 'objectClass' => array('inetOrgPerson'),
154
+ ));
155
+
156
+ $entryManager = $ldap->getEntryManager();
157
+
158
+ // Adding multiple email adresses at once
159
+ $entryManager->applyOperations($entry->getDn(), array(
160
+ new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', 'new1@example.com'),
161
+ new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', 'new2@example.com'),
162
+ ));
163
+
164
+ Possible operation types are ``LDAP_MODIFY_BATCH_ADD ``, ``LDAP_MODIFY_BATCH_REMOVE ``,
165
+ ``LDAP_MODIFY_BATCH_REMOVE_ALL ``, ``LDAP_MODIFY_BATCH_REPLACE ``. Parameter
166
+ ``$values `` must be ``NULL `` when using ``LDAP_MODIFY_BATCH_REMOVE_ALL ``
167
+ operation type.
168
+
169
+ .. versionadded :: 4.2
170
+ The ``applyOperations() `` method was introduced in Symfony 4.2.
171
+
140
172
.. versionadded :: 4.1
141
173
The ``addAttributeValues() `` and ``removeAttributeValues() `` methods
142
174
were introduced in Symfony 4.1.
0 commit comments