Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added Commandline Support to include/export Tables from migration #65

Merged
merged 0 commits into from Apr 11, 2012

Conversation

Projects
None yet
4 participants
@ghost

ghost commented Apr 10, 2012

this pull request depends on
https://github.com/doctrine/dbal/pull/132

@Baachi Baachi and 1 other commented on an outdated diff Apr 10, 2012

.../Migrations/Tools/Console/Command/AbstractCommand.php
@@ -49,6 +49,19 @@ protected function configure()
{
$this->addOption('configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a migrations configuration file.');
$this->addOption('db-configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a database connection configuration file.');
+ $this->addOption('filterAssets', null, InputOption::VALUE_NONE, 'Tables which are filtered.');
+ $this->addOption('filter', 'include', InputOption::VALUE_NONE, 'To include/exclude.');
+ }
+
+ protected function initialize(InputInterface $input, OutputInterface $output) {
+ $filter = $input->getOption('filter') == 'include'? true: false;
@Baachi

Baachi Apr 10, 2012

<?php 
$filter = $input->getOption('filter') === 'include';

is better.

@stof

stof Apr 10, 2012

Member

btw, this is simply wrong. As you use InputOption::VALUE_NONE, $input->getOption('filter') will always be a boolean (true if --filter was used and false otherwise)

@stof stof commented on an outdated diff Apr 10, 2012

.../Migrations/Tools/Console/Command/AbstractCommand.php
@@ -49,6 +49,19 @@ protected function configure()
{
$this->addOption('configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a migrations configuration file.');
$this->addOption('db-configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a database connection configuration file.');
+ $this->addOption('filterAssets', null, InputOption::VALUE_NONE, 'Tables which are filtered.');
+ $this->addOption('filter', 'include', InputOption::VALUE_NONE, 'To include/exclude.');
+ }
+
+ protected function initialize(InputInterface $input, OutputInterface $output) {
@stof

stof Apr 10, 2012

Member

the curly brace should be on its own line

@stof stof commented on an outdated diff Apr 10, 2012

.../Migrations/Tools/Console/Command/AbstractCommand.php
@@ -49,6 +49,19 @@ protected function configure()
{
$this->addOption('configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a migrations configuration file.');
$this->addOption('db-configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a database connection configuration file.');
+ $this->addOption('filterAssets', null, InputOption::VALUE_NONE, 'Tables which are filtered.');
+ $this->addOption('filter', 'include', InputOption::VALUE_NONE, 'To include/exclude.');
+ }
+
+ protected function initialize(InputInterface $input, OutputInterface $output) {
+ $filter = $input->getOption('filter') == 'include'? true: false;
+ if ($input->getOption('filterAssets')) {
+ $filterAssets = $input->getOption('filterAssets');
+ $em = $this->getHelper('em')->getEntityManager();
+ $em->getConnection()
+ ->getConfiguration()
+ ->setFilterSchemaAssetsExpression($filterAssets, $filter);
+ }
@stof

stof Apr 10, 2012

Member

you should use $db = $this->getHelper('db')->getConnection() to get the connection directly IMO

@stof stof commented on an outdated diff Apr 10, 2012

.../Migrations/Tools/Console/Command/AbstractCommand.php
@@ -49,6 +49,19 @@ protected function configure()
{
$this->addOption('configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a migrations configuration file.');
$this->addOption('db-configuration', null, InputOption::VALUE_OPTIONAL, 'The path to a database connection configuration file.');
+ $this->addOption('filterAssets', null, InputOption::VALUE_NONE, 'Tables which are filtered.');
+ $this->addOption('filter', 'include', InputOption::VALUE_NONE, 'To include/exclude.');
@stof

stof Apr 10, 2012

Member

include as shortcut for filter ? In Unix-style CLIs, shortcuts are only 1 char (and in probably all interfaces, they are shorter than the original name)

@Hounddog Hounddog merged commit 9610f6b into doctrine:master Apr 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment