8000 Allow adding and removing values to/from multi-valued attributes · symfony/symfony@03932c6 · GitHub
[go: up one dir, main page]

Skip to content
Sign in

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 03932c6

Browse files
committed
Allow adding and removing values to/from multi-valued attributes
1 parent 3086d0e commit 03932c6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public function remove(Entry $entry)
7171
* Adds values to an entry's multi-valued attribute from the Ldap server.
7272
*
7373
* @param Entry $entry
74-
* @param $attribute
75-
* @param $values
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

@@ -91,13 +91,13 @@ public function addValues(Entry $entry, $attribute, $values)
9191
* Removes values from an entry's multi-valued attribute from the Ldap server.
9292
*
9393
* @param Entry $entry
94-
* @param $attribute
95-
* @param $values
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

Lines 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