public function run() { $arguments = $this->getArguments(); $cme = new ClassMetadataExporter(); $cme->setEntityManager($this->getConfiguration()->getAttribute('em')); $printer = $this->getPrinter(); // Get exporter and configure it $exporter = $cme->getExporter($arguments['to'], $arguments['dest']); if ($arguments['to'] === 'annotation') { $entityGenerator = new EntityGenerator(); $exporter->setEntityGenerator($entityGenerator); if (isset($arguments['extend']) && $arguments['extend']) { $entityGenerator->setClassToExtend($arguments['extend']); } if (isset($arguments['num-spaces']) && $arguments['extend']) { $entityGenerator->setNumSpaces($arguments['num-spaces']); } } $from = (array) $arguments['from']; foreach ($from as $source) { $cme->addMappingSource($source); } $metadatas = $cme->getMetadatas(); foreach ($metadatas as $metadata) { $printer->writeln(sprintf('Processing entity "%s"', $printer->format($metadata->name, 'KEYWORD'))); } $printer->writeln(''); $printer->writeln(sprintf('Exporting "%s" mapping information to "%s"', $printer->format($arguments['to'], 'KEYWORD'), $printer->format($arguments['dest'], 'KEYWORD'))); $exporter->setMetadatas($metadatas); $exporter->export(); }