Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,38 @@ delete existing ones::
// Removing an existing entry
$entryManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));


Batch Updating
______________

Use the entry manager's :method:`Symfony\\Component\\Ldap\\Adapter\\ExtLdap\\EntryManager::applyOperations`
method to update multiple attributes at once::

use Symfony\Component\Ldap\Ldap;
use Symfony\Component\Ldap\Entry;
// ...

$entry = new Entry('cn=Fabien Potencier,dc=symfony,dc=com', array(
'sn' => array('fabpot'),
'objectClass' => array('inetOrgPerson'),
));

$entryManager = $ldap->getEntryManager();

// Adding multiple email adresses at once
$entryManager->applyOperations($entry->getDn(), array(
new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', '[email protected]'),
new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', '[email protected]'),
));

Possible operation types are ``LDAP_MODIFY_BATCH_ADD``, ``LDAP_MODIFY_BATCH_REMOVE``,
``LDAP_MODIFY_BATCH_REMOVE_ALL``, ``LDAP_MODIFY_BATCH_REPLACE``. Parameter
``$values`` must be ``NULL`` when using ``LDAP_MODIFY_BATCH_REMOVE_ALL``
operation type.

.. versionadded:: 4.2
The ``applyOperations()`` method was introduced in Symfony 4.2.

.. versionadded:: 4.1
The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
were introduced in Symfony 4.1.
Expand Down