fixing undefined variable name, and removing unexisting namespace. I backtraced code to the actal mongodb maping clas and it doesn't seem to throw any exceptions, but just in case I'm catching the general \Exception

This commit is contained in:
Miha Vrhovnik 2011-03-21 11:04:52 +01:00
parent e57075ea60
commit e9e0f9f102

View File

@ -11,7 +11,6 @@
namespace Symfony\Bundle\DoctrineMongoDBBundle\Command; namespace Symfony\Bundle\DoctrineMongoDBBundle\Command;
use Doctrine\ODM\MongoDB\Mapping\MappingException;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -59,7 +58,7 @@ EOT
->getMetadataDriverImpl() ->getMetadataDriverImpl()
->getAllClassNames(); ->getAllClassNames();
if (!$entityClassNames) { if (!$documentClassNames) {
throw new \Exception( throw new \Exception(
'You do not have any mapped Doctrine MongoDB ODM documents for any of your bundles. '. 'You do not have any mapped Doctrine MongoDB ODM documents for any of your bundles. '.
'Create a class inside the Document namespace of any of your bundles and provide '. 'Create a class inside the Document namespace of any of your bundles and provide '.
@ -75,7 +74,7 @@ EOT
try { try {
$cm = $documentManager->getClassMetadata($documentClassName); $cm = $documentManager->getClassMetadata($documentClassName);
$output->write("<info>[OK]</info> " . $documentClassName, true); $output->write("<info>[OK]</info> " . $documentClassName, true);
} catch(MappingException $e) { } catch(\Exception $e) {
$output->write("<error>[FAIL]</error> " . $documentClassName, true); $output->write("<error>[FAIL]</error> " . $documentClassName, true);
$output->write("<comment>" . $e->getMessage()."</comment>", true); $output->write("<comment>" . $e->getMessage()."</comment>", true);
$output->write("", true); $output->write("", true);