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

Skip to content

[LDAP] Add docs for applyOperations method #9715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2018
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