From 98cf9017a84547eb33fc3c2829ef7583bd5dc6e3 Mon Sep 17 00:00:00 2001
From: jwage <jwage@625475ce-881a-0410-a577-b389adb331d8>
Date: Thu, 8 Oct 2009 16:21:22 +0000
Subject: [PATCH] [2.0][DDC-35] Fixing accidental rename of file

---
 ...MappingTask.php => ConvertMappingTask.php} | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
 rename lib/Doctrine/ORM/Tools/Cli/Tasks/{MappingTask.php => ConvertMappingTask.php} (90%)

diff --git a/lib/Doctrine/ORM/Tools/Cli/Tasks/MappingTask.php b/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php
similarity index 90%
rename from lib/Doctrine/ORM/Tools/Cli/Tasks/MappingTask.php
rename to lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php
index d0cf8f4e8..f5b39c33b 100644
--- a/lib/Doctrine/ORM/Tools/Cli/Tasks/MappingTask.php
+++ b/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php
@@ -57,10 +57,12 @@ class ConvertMappingTask extends AbstractTask
     
         $printer->writeln('Description: Convert mapping information between supported formats.')
                 ->writeln('Options:')
-                ->write('--from=<PATH>', 'REQ_ARG')
-                ->writeln("\tThe path to the mapping information you are converting from.")
+                ->write('--from=<SOURCE>', 'REQ_ARG')
+                ->writeln("\tThe path to the mapping information to convert from (yml, xml, php, annotation).")
+                ->write('--from-database', 'REQ_ARG')
+                ->writeln("\tUse this option if you wish to reverse engineer your database to a set of Doctrine mapping files.")
                 ->write('--to=<TYPE>', 'REQ_ARG')
-                ->writeln("\tThe format to convert to.")
+                ->writeln("\tThe format to convert to (yml, xml, php, annotation).")
                 ->write(PHP_EOL)
                 ->write('--dest=<PATH>', 'REQ_ARG')
                 ->writeln("\tThe path to write the converted mapping information.");
@@ -77,9 +79,10 @@ class ConvertMappingTask extends AbstractTask
     private function _writeSynopsis($printer)
     {
         $printer->write('convert-mapping', 'KEYWORD')
-                ->write(' --from=<PATH>', 'REQ_ARG')
+                ->write(' --from=<SOURCE>', 'REQ_ARG')
                 ->write(' --to=<TYPE>', 'REQ_ARG')
-                ->writeln(' --dest=<PATH>', 'REQ_ARG');
+                ->write(' --dest=<PATH>', 'REQ_ARG')
+                ->writeln(' --from-database', 'OPT_ARG');
     }
 
     /**
@@ -94,8 +97,13 @@ class ConvertMappingTask extends AbstractTask
         $args = $this->getArguments();
         $printer = $this->getPrinter();
 
+        if (array_key_exists('from-database', $args)) {
+            $args['from'][0] = 'database';
+            $this->setArguments($args);
+        }
+
         if (!(isset($args['from']) && isset($args['to']) && isset($args['dest']))) {
-          $printer->writeln('You must include a value for all four options: --from, --to and --dest', 'ERROR');
+          $printer->writeln('You must include a value for all three options: --from, --to and --dest', 'ERROR');
           return false;
         }
         if ($args['to'] != 'annotation' && isset($args['extend'])) {