소스 검색

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()
                                           ->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) {