Skip to content

Commit 9eda50b

Browse files
committed
minor #9553 Documented how to add or remove values of multi-valued attributes (jean-gui)
This PR was merged into the master branch. Discussion ---------- Documented how to add or remove values of multi-valued attributes Related to symfony/symfony#21856 <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 40df041 Documented how to add or remove values of multi-valued attributes
2 parents 8f8ddff + 40df041 commit 9eda50b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/ldap.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,16 @@ delete existing ones::
129129
$entry = $result[0];
130130
$entry->setAttribute('email', array('fabpot@symfony.com'));
131131
$entityManager->update($entry);
132+
133+
// Adding or removing values to a multi-valued attribute is more efficient than using update()
134+
$entityManager->addAttributeValues($entry, 'telephoneNumber', array('+1.111.222.3333', '+1.222.333.4444'));
135+
$entityManager->removeAttributeValues($entry, 'telephoneNumber', array('+1.111.222.3333', '+1.222.333.4444'));
132136

133137
// Removing an existing entry
134138
$entityManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
135139

140+
.. versionadded:: 4.1
141+
The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
142+
were introduced in Symfony 4.1.
143+
136144
.. _Packagist: https://packagist.org/packages/symfony/ldap

0 commit comments

Comments
 (0)