diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php index 37a8e3f76..eb7697ccb 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php @@ -21,6 +21,7 @@ namespace Doctrine\ORM\Tools\Console\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Doctrine\ORM\Tools\SchemaValidator; @@ -45,7 +46,20 @@ class ValidateSchemaCommand extends Command $this ->setName('orm:validate-schema') ->setDescription('Validate the mapping files.') - ->setHelp(<<addOption( + 'skip-mapping', + null, + InputOption::VALUE_NONE, + 'Skip the mapping validation check' + ) + ->addOption( + 'skip-sync', + null, + InputOption::VALUE_NONE, + 'Skip checking if the mapping is in sync with the database' + ) + ->setHelp( + <<getHelper('em')->getEntityManager(); - $validator = new SchemaValidator($em); - $errors = $validator->validateMapping(); - $exit = 0; - if ($errors) { + + if ($input->getOption('skip-mapping')) { + $output->writeln('[Mapping] Skipped mapping check.'); + } elseif ($errors = $validator->validateMapping()) { foreach ($errors as $className => $errorMessages) { $output->writeln("[Mapping] FAIL - The entity-class '" . $className . "' mapping is invalid:"); @@ -78,7 +92,9 @@ EOT $output->writeln('[Mapping] OK - The mapping files are correct.'); } - if (!$validator->schemaInSyncWithMetadata()) { + if ($input->getOption('skip-sync')) { + $output->writeln('[Database] SKIPPED - The database was not checked for synchronicity.'); + } elseif (!$validator->schemaInSyncWithMetadata()) { $output->writeln('[Database] FAIL - The database schema is not in sync with the current mapping file.'); $exit += 2; } else {