10000 [LDAP] Add docs for applyOperations method · symfony/symfony-docs@74fed75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74fed75

Browse files
committed
[LDAP] Add docs for applyOperations method
See PR symfony/symfony#27069
1 parent 528857d commit 74fed75

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

components/ldap.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,38 @@ delete existing ones::
137137
// Removing an existing entry
138138
$entryManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
139139

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+
140172
.. versionadded:: 4.1
141173
The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
142174
were introduced in Symfony 4.1.

0 commit comments

Comments
 (0)
0