Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 0 commits into from

4 participants

.../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 added a note
<?php 
$filter = $input->getOption('filter') === 'include';

is better.

@stof Collaborator
stof added a note

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
.../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 Collaborator
stof added a note

the curly brace should be on its own line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
.../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 Collaborator
stof added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
.../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 Collaborator
stof added a note

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Hounddog Hounddog merged commit 9610f6b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Sorry, commit information is not available for this pull request.

Something went wrong with that request. Please try again.