Author: david
Date: Thu Oct 8 11:18:24 2009
New Revision: 3690
Log:
Add conditions to avoid warnings for empty foreach().
Modified:
trunk/lib/task/migrate/QubitMigrate.class.php
Modified: trunk/lib/task/migrate/QubitMigrate.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate.class.php Thu Oct 8 00:02:26
2009 (r3689)
+++ trunk/lib/task/migrate/QubitMigrate.class.php Thu Oct 8 11:18:24
2009 (r3690)
@@ -89,16 +89,19 @@
protected function deleteStubObjects()
{
// Delete "stub" QubitEvent objects that have no valid "event type"
- foreach ($this->data['QubitEvent'] as $key => $event)
+ if (isset($this->data['QubitEvent']) &&
is_array($this->data['QubitEvent']))
{
- if (!isset($event['type_id']))
+ foreach ($this->data['QubitEvent'] as $key => $event)
{
- unset($this->data['QubitEvent'][$key]);
-
- // Also delete related QubitObjectTermRelation object (if any)
- while ($objectTermRelationKey =
$this->getRowKey('QubitObjectTermRelation', 'object_id', $key))
+ if (!isset($event['type_id']))
{
-
unset($this->data['QubitObjectTermRelation'][$objectTermRelationKey]);
+ unset($this->data['QubitEvent'][$key]);
+
+ // Also delete related QubitObjectTermRelation object (if any)
+ while ($objectTermRelationKey =
$this->getRowKey('QubitObjectTermRelation', 'object_id', $key))
+ {
+
unset($this->data['QubitObjectTermRelation'][$objectTermRelationKey]);
+ }
}
}
}
@@ -110,11 +113,14 @@
}
// Remove blank "stub" QubitObjectTermRelation objects
- foreach ($this->data['QubitObjectTermRelation'] as $key => $row)
+ if (isset($this->data['QubitObjectTermRelation']) &&
is_array($this->data['QubitObjectTermRelation']))
{
- if (!isset($row['object_id']) || !isset($row['term_id']))
+ foreach ($this->data['QubitObjectTermRelation'] as $key => $row)
{
- unset($this->data['QubitObjectTermRelation'][$key]);
+ if (!isset($row['object_id']) || !isset($row['term_id']))
+ {
+ unset($this->data['QubitObjectTermRelation'][$key]);
+ }
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---