/**
  * Determines what action should be performed and takes that action.
  *
  * @uses MpmRunController::displayHelp()
  * @uses MpmCommandLineWriter::getInstance()
  * @uses MpmCommandLineWriter::addText()
  * @uses MpmCommandLineWriter::write()
  * @uses MpmCommandLineWriter::writeHeader()
  * @uses MpmCommandLineWriter::writeFooter()
  * @uses MpmMigrationHelper::doesMigrationExist() 
  * @uses MpmMigrationHelper::getMigrationObject()
  * @uses MpmMigrationHelper::runMigration()
  *
  * @return void
  */
 public function doAction()
 {
     // make sure system is init'ed
     MpmDbHelper::test();
     if (count($this->arguments) != 2) {
         $obj = MpmCommandLineWriter::getInstance();
         $obj->addText('ERROR: You must provide two arguments with this command.');
         $obj->addText(' ');
         $this->displayHelp();
         return;
     }
     // are we running the up or the down?
     $type = strtolower($this->arguments[0]);
     // what number do we want to run?
     $num = $this->arguments[1];
     if (!is_numeric($num)) {
         $obj = MpmCommandLineWriter::getInstance();
         $obj->addText('ERROR: Migration number must be numeric.');
         $obj->addText(' ');
         $this->displayHelp();
         return;
     }
     if ($type != 'up' && $type != 'down') {
         $obj = MpmCommandLineWriter::getInstance();
         $obj->addText('ERROR: Method must be either up or down.');
         $obj->addText(' ');
         $this->displayHelp();
         return;
     }
     // does this migration number exist?
     if (!MpmMigrationHelper::doesMigrationExist($num)) {
         $obj = MpmCommandLineWriter::getInstance();
         $obj->addText('ERROR: Migration ' . $num . ' does not exist.');
         $obj->write();
         return;
     }
     $row = MpmMigrationHelper::getMigrationObject($num);
     $obj = MpmCommandLineWriter::getInstance();
     $obj->writeHeader();
     MpmMigrationHelper::runMigration($row, $type);
     echo "\n";
     $obj->writeFooter();
 }