From 138ef0d1ae641e71048ce57e1d2a1e52f58aaa04 Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Sun, 13 Mar 2011 12:49:36 -0500 Subject: [PATCH] Improving output of doctrine:mapping:info command. --- .../DoctrineBundle/Command/InfoDoctrineCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php index 70084e0770..7399ac344e 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php +++ b/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 %d entities mapped in entity manager %s:\n", count($entityClassNames), $entityManagerName), true); foreach ($entityClassNames as $entityClassName) {