Removed notice-level errors

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40422 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-08-17 05:43:34 +00:00
parent c04c8f1a5c
commit ac29eb5b89

View File

@ -159,6 +159,8 @@ class ComponentSet extends DataObjectSet {
* @param array $idList List of IDs.
*/
function setByIDList($idList) {
$has = array();
// Index current data
if($this->items) {
foreach($this->items as $item) {
@ -172,13 +174,14 @@ class ComponentSet extends DataObjectSet {
if($idList){
foreach($idList as $id) {
$itemsToDelete[$id] = false;
if(!$has[$id] && $id) {
if(!isset($has[$id]) && $id) {
$this->add($id);
}
}
}
// Delete any unmentionedItems
if($itemsToDelete) {
$removeList = array();
foreach($itemsToDelete as $id => $actuallyDelete) {
if($actuallyDelete) $removeList[] = $id;
}