21493 Posts in 5784 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 796 Views |
-
Bug in removeDuplicates()?

3 February 2010 at 5:28am
I'm combining two DataObjectSets and I want only the unique entries.
I thought it was an error in my code, but it appears to me that removeDuplicates() actually removes all entries. I'm not quite sure whether it's a bug as I may have something else wrong in the code. I've written a quick test script, can someone please verify whether this is a bug or an error on my side?
$one = new DataObject();
$one->ID = 1;
$one->Title = "One";
$two = new DataObject();
$two->ID = 2;
$two->Title = "Two";$test = new DataObjectSet();
$test->addWithoutWrite ($one);
$test->addWithoutWrite ($two);
$test->addWithoutWrite ($one);Debug::show($test); // Shows 1 2 1
Debug::show($test->removeDuplicates()); // Empty. -
Re: Bug in removeDuplicates()?

3 February 2010 at 11:41am
removeDuplicates() doesn't return anything.
try:
...
Debug::show($test); // Shows 1 2 1
$test->removeDuplicates();
Debug::show($test); // Shows 1 2 -
Re: Bug in removeDuplicates()?

3 February 2010 at 9:05pm
Thank you Hamish, should have read the docs better. Clearly another case of user error
| 796 Views | ||
|
Page:
1
|
Go to Top |


