Created
April 5, 2012 19:24
-
-
Save jaspernbrouwer/2313393 to your computer and use it in GitHub Desktop.
Symfony 2 console command proxy for Doctrine's ValidateSchemaCommand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Nw/LibBundle/Command/ValidateSchemaCommand.php | |
namespace Nw\LibBundle\Command; | |
use Symfony\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Output\Output; | |
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidateSchemaCommand; | |
/** | |
* Command to validate that the current mapping is valid. | |
* | |
* @author Jasper N. Brouwer <[email protected]> | |
*/ | |
class ValidateSchemaCommand extends DoctrineValidateSchemaCommand | |
{ | |
/** {@inheritdoc} */ | |
protected function configure() | |
{ | |
parent::configure(); | |
$this->setName( 'doctrine:schema:validate' ) | |
->setDescription( 'Validate that the mapping files' ) | |
->addOption( 'em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command' ) | |
->setHelp( 'Validate that the mapping files are correct and in sync with the database.' ); | |
} | |
/** {@inheritdoc} */ | |
protected function execute( InputInterface $input, OutputInterface $output ) | |
{ | |
DoctrineCommandHelper::setApplicationEntityManager( $this->getApplication(), $input->getOption( 'em' )); | |
parent::execute( $input, $output ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment