Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit afd02ff

Browse filesBrowse files
committed
Allow adding and removing values to/from multi-valued attributes
1 parent 3086d0e commit afd02ff
Copy full SHA for afd02ff

File tree

2 files changed

+15
-15
lines changed
Filter options

2 files changed

+15
-15
lines changed

‎src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ public function remove(Entry $entry)
7070
/**
7171
* Adds values to an entry's multi-valued attribute from the Ldap server.
7272
*
73-
* @param Entry $entry
74-
* @param $attribute
75-
* @param $values
73+
* @param Entry $entry
74+
* @param string $attribute
75+
* @param array $values
7676
*
7777
* @throws NotBoundException
7878
* @throws LdapException
7979
*/
80-
public function addValues(Entry $entry, $attribute, $values)
80+
public function addAttributeValues(Entry $entry, string $attribute, array $values)
8181
{
8282
$con = $this->getConnectionResource();
8383

@@ -90,14 +90,14 @@ public function addValues(Entry $entry, $attribute, $values)
9090
/**
9191
* Removes values from an entry's multi-valued attribute from the Ldap server.
9292
*
93-
* @param Entry $entry
94-
* @param $attribute
95-
* @param $values
93+
* @param Entry $entry
94+
* @param string $attribute
95+
* @param array $values
9696
*
9797
* @throws NotBoundException
9898
* @throws LdapException
9999
*/
100-
public function removeValues(Entry $entry, $attribute, $values)
100+
public function removeAttributeValues(Entry $entry, string $attribute, array $values)
101101
{
102102
$con = $this->getConnectionResource();
103103

‎src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,29 +193,29 @@ public function testLdapRenameWithoutRemovingOldRdn()
193193
$this->executeSearchQuery(1);
194194
}
195195

196-
public function testLdapAddRemoveValues()
196+
public function testLdapAddRemoveAttributeValues()
197197
{
198198
$entryManager = $this->adapter->getEntryManager();
199199

200200
$result = $this->executeSearchQuery(1);
201201
$entry = $result[0];
202202

203-
$entryManager->addValues($entry, 'mail', array('fabpot@example.org', 'fabpot2@example.org'));
203+
$entryManager->addAttributeValues($entry, 'mail', array('fabpot@example.org', 'fabpot2@example.org'));
204204

205205
$result = $this->executeSearchQuery(1);
206206
$newEntry = $result[0];
207207

208208
$this->assertCount(4, $newEntry->getAttribute('mail'));
209209

210-
$entryManager->removeValues($newEntry, 'mail', array('fabpot@example.org', 'fabpot2@example.org'));
210+
$entryManager->removeAttributeValues($newEntry, 'mail', array('fabpot@example.org', 'fabpot2@example.org'));
211211

212212
$result = $this->executeSearchQuery(1);
213213
$newNewEntry = $result[0];
214214

215215
$this->assertCount(2, $newNewEntry->getAttribute('mail'));
216216
}
217217

218-
public function testLdapRemoveValuesError()
218+
public function testLdapRemoveAttributeValuesError()
219219
{
220220
$entryManager = $this->adapter->getEntryManager();
221221

@@ -224,10 +224,10 @@ public function testLdapRemoveValuesError()
224224

225225
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
226226

227-
$entryManager->removeValues($entry, 'mail', array('fabpot@example.org'));
227+
$entryManager->removeAttributeValues($entry, 'mail', array('fabpot@example.org'));
228228
}
229229

230-
public function testLdapAddValuesError()
230+
public function testLdapAddAttributeValuesError()
231231
{
232232
$entryManager = $this->adapter->getEntryManager();
233233

@@ -236,6 +236,6 @@ public function testLdapAddValuesError()
236236

237237
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
238238

239-
$entryManager->addValues($entry, 'mail', $entry->getAttribute('mail'));
239+
$entryManager->addAttributeValues($entry, 'mail', $entry->getAttribute('mail'));
240240
}
241241
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.