Author: jablko
Date: Sun Nov 29 13:02:37 2009
New Revision: 3997

Log:
Simplify ->alterData() by moving some logic to its caller

Modified:
   trunk/lib/task/migrate/QubitMigrate108to110.class.php

Modified: trunk/lib/task/migrate/QubitMigrate108to110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate108to110.class.php       Sun Nov 29 
12:47:44 2009        (r3996)
+++ trunk/lib/task/migrate/QubitMigrate108to110.class.php       Sun Nov 29 
13:02:37 2009        (r3997)
@@ -32,18 +32,8 @@
    *
    * @return QubitMigrate108to110 this object
    */
-  protected function alterData()
+  protected function alterData($version)
   {
-    // Find version
-    foreach ($this->data['QubitSetting'] as $key => $value)
-    {
-      if ('version' == $value['name'])
-      {
-        $version = $value['value'][$value['source_culture']];
-        break;
-      }
-    }
-
     switch ($version)
     {
       default:
@@ -59,12 +49,6 @@
     // Delete "stub" objects
     $this->deleteStubObjects();
 
-    $parser = new sfYamlParser;
-    $data = 
$parser->parse(file_get_contents(sfConfig::get('sf_data_dir').'/fixtures/settings.yml'));
-
-    // Update version
-    $this->data['QubitSetting'][$key] = $data['QubitSetting']['version'];
-
     return $this;
   }
 
@@ -85,6 +69,31 @@
     return $this;
   }
 
+  public function execute()
+  {
+    // Find version
+    foreach ($this->data['QubitSetting'] as $key => $value)
+    {
+      if ('version' == $value['name'])
+      {
+        $version = $value['value'][$value['source_culture']];
+        break;
+      }
+    }
+
+    $this->alterData($version);
+
+    $parser = new sfYamlParser;
+    $data = 
$parser->parse(file_get_contents(sfConfig::get('sf_data_dir').'/fixtures/settings.yml'));
+
+    // Update version
+    $this->data['QubitSetting'][$key] = $data['QubitSetting']['version'];
+
+    $this->sortData();
+
+    return $this->getData();
+  }
+
   /**
    * Change table name from QubitActorName to QubitOtherName and column
    * actor_id -> object_id 

--

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.com/group/qubit-commits?hl=en.


Reply via email to