浏览代码

Improving output of doctrine:mapping:info command.

Jonathan H. Wage 14 年之前
父节点
当前提交
138ef0d1ae
共有 1 个文件被更改,包括 10 次插入1 次删除
  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()
                                           ->getMetadataDriverImpl()
                                           ->getAllClassNames();
                                           ->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);
             count($entityClassNames), $entityManagerName), true);
         
         
         foreach ($entityClassNames as $entityClassName) {
         foreach ($entityClassNames as $entityClassName) {