public function run()
 {
     $arguments = $this->getArguments();
     $cme = new ClassMetadataExporter();
     $printer = $this->getPrinter();
     // Get exporter and configure it
     $exporter = $cme->getExporter($arguments['to'], $arguments['dest']);
     if (isset($arguments['extend']) && $arguments['extend']) {
         $exporter->setClassToExtend($arguments['extend']);
     }
     if (isset($arguments['num-spaces']) && $arguments['extend']) {
         $exporter->setNumSpaces($arguments['num-spaces']);
     }
     $from = (array) $arguments['from'];
     if ($this->_isDoctrine1Schema($from)) {
         $printer->writeln('Converting Doctrine 1 schema to Doctrine 2 mapping files', 'INFO');
         $converter = new \Doctrine\ORM\Tools\ConvertDoctrine1Schema($from);
         $metadatas = $converter->getMetadatasFromSchema();
     } else {
         foreach ($from as $source) {
             $sourceArg = $source;
             $type = $this->_determineSourceType($sourceArg);
             if (!$type) {
                 throw CliException::invalidMappingSourceType($sourceArg);
             }
             $source = $this->_getSourceByType($type, $sourceArg);
             $printer->writeln(sprintf('Adding "%s" mapping source which contains the "%s" format', $printer->format($sourceArg, 'KEYWORD'), $printer->format($type, 'KEYWORD')));
             $cme->addMappingSource($source, $type);
         }
         $metadatas = $cme->getMetadatasForMappingSources();
     }
     foreach ($metadatas as $metadata) {
         $printer->writeln(sprintf('Processing entity "%s"', $printer->format($metadata->name, 'KEYWORD')));
     }
     $printer->writeln(sprintf('Exporting "%s" mapping information to directory "%s"', $printer->format($arguments['to'], 'KEYWORD'), $printer->format($arguments['dest'], 'KEYWORD')));
     $exporter->setMetadatas($metadatas);
     $exporter->export();
 }