From 840625530512f8f096ca0fd412760c06ca746404 Mon Sep 17 00:00:00 2001 From: Matt Button Date: Thu, 30 Dec 2010 03:42:03 +0000 Subject: [PATCH] Fixing a bug where the migration model gets mixed up if you pass in a numerically indexed array of locations as opposed to an associative one --- classes/model/minion/migration.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/classes/model/minion/migration.php b/classes/model/minion/migration.php index 499ffa2..f3aa68a 100644 --- a/classes/model/minion/migration.php +++ b/classes/model/minion/migration.php @@ -184,6 +184,20 @@ class Model_Minion_Migration extends Model $locations = $this->fetch_all('location', 'location'); } } + // If the calling script has been lazy and given us a numerically + // indexed array of locations then we need to convert it to a mirrored + // array + // + // We will decide the target version for these within the loop below + elseif( ! Arr::is_assoc($locations)) + { + foreach($locations as $_pos => $location) + { + unset($locations[$_pos]); + + $locations[$location] = $location; + } + } // Merge locations with specified target versions if( ! empty($target_version) AND is_array($target_version))