. */ namespace Doctrine\ORM\Tools\Console\Command; use Symfony\Components\Console\Input\InputArgument, Symfony\Components\Console\Input\InputOption, Symfony\Components\Console; /** * Schema Validator Command * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.com * @since 1.0 * @version $Revision$ * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel */ class SchemaValidatorCommand extends Console\Command\Command { /** * @see Console\Command\Command */ protected function configure() { $this ->setName('orm:validate-schema') ->setDescription('Validate that the mapping files.') ->setHelp(<<getHelper('em')->getEntityManager(); $validator = new \Doctrine\ORM\Tools\SchemaValidator($em); $errors = $validator->validateMapping(); if ($errors) { foreach ($errors AS $className => $errorMessages) { $output->write("The entity-class '" . $className . "' is invalid:\n"); foreach ($errorMessages AS $errorMessage) { $output->write('* ' . $errorMessage . "\n"); } $output->write("\n"); } } if (!$validator->schemaInSyncWithMetadata()) { $output->write('The database schema is not in sync with the current mapping file.'); } } }