Last active
December 20, 2015 19:09
-
-
Save b-b3rn4rd/6180804 to your computer and use it in GitHub Desktop.
Allow 'orm:schema-tool:update' to filter entities
This file contains 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 | |
namespace My\Doctrine\ORM\Tools\Console\Command\SchemaTool; | |
use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand as UpdateCommand2, | |
Symfony\Component\Console\Input\InputArgument, | |
Symfony\Component\Console\Input\InputOption, | |
Symfony\Component\Console\Input\InputInterface, | |
Symfony\Component\Console\Output\OutputInterface, | |
Doctrine\ORM\Tools\SchemaTool, | |
Doctrine\ORM\Tools\Console\MetadataFilter; | |
class UpdateCommand extends UpdateCommand2 | |
{ | |
protected function configure() | |
{ | |
parent::configure(); | |
$this->addOption('filter', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A string pattern used to match entities that should be processed.'); | |
} | |
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas) | |
{ | |
$metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); | |
parent::executeSchemaCommand($input, $output, $schemaTool, $metadatas); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment