Browse Source

Improving output of doctrine:mapping:info command.

Jonathan H. Wage 14 years ago
parent
commit
138ef0d1ae
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php

+ 10 - 1
src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php

@@ -58,7 +58,16 @@ EOT
                                           ->getMetadataDriverImpl()
                                           ->getAllClassNames();
 
-        $output->write(sprintf("Found %d entities mapped in entity manager '%s':",
+        if (!$entityClassNames) {
+            throw new \Exception(
+                'You do not have any mapped Doctrine ORM entities for any of your bundles. '.
+                'Create a class inside the Entity namespace of any of your bundles and provide '.
+                'mapping information for it with Annotations directly in the classes doc blocks '.
+                'or with XML/YAML in your bundles Resources/config/doctrine/metadata/orm directory.'
+            );
+        }
+
+        $output->write(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:\n",
             count($entityClassNames), $entityManagerName), true);
         
         foreach ($entityClassNames as $entityClassName) {