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