Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

sql-insert command should use configuration file #550

Closed
wants to merge 1 commit into from

2 participants

@nekufa

Looks like it was designed the buildtime-conf is used by all console commands (AbstractCommand@getGeneratorConfig).
SqlInsert command overrides input-dir property (as sql source location).
So getGeneratorConfig method looks for database configuration in generated-sql folder.

I've changed input-dir property to sql-dir property, so sql scripts would be look up there, and connection settings are looking in default input-dir (as other console commands).

@nekufa nekufa sql-insert command should use configuration file
Looks like it was designed the buildtime-conf is used by all console commands (AbstractCommand@getGeneratorConfig).
SqlInsert command overrides input-dir property (as sql source location).
So getGeneratorConfig method looks for database configuration in generated-sql folder.

I've changed input-dir property to sql-dir property, so sql scripts would be look up there, and connection settings are looking in default input-dir (as other console commands).
9c1f370
@marcj
Owner

Well, you would need to update TestPrepareCommand as well or the test suite won't be green.

@marcj
Owner

ping @nekufa

@marcj marcj added the Enhancement label
@nekufa

@marcj sorry, but i don't understand how ti give repository fork back.
i suddenly removed it and can't edit this pull request anymore :( can you help me?

@nekufa

maybe i can create new fork, make changes, complete tests and send new pull request?

@marcj
Owner

Sure, just send a new one :)

@marcj marcj closed this
@nekufa

Okey, thanks! :)
Unit tests not run out of the box - maybe there are developer notes somewhere?

@marcj
Owner

Take a look here please: http://propelorm.org/contribute.html

@nekufa

thanks, that is what i need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 24, 2014
  1. @nekufa

    sql-insert command should use configuration file

    nekufa authored
    Looks like it was designed the buildtime-conf is used by all console commands (AbstractCommand@getGeneratorConfig).
    SqlInsert command overrides input-dir property (as sql source location).
    So getGeneratorConfig method looks for database configuration in generated-sql folder.
    
    I've changed input-dir property to sql-dir property, so sql scripts would be look up there, and connection settings are looking in default input-dir (as other console commands).
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/Propel/Generator/Command/SqlInsertCommand.php
View
6 src/Propel/Generator/Command/SqlInsertCommand.php
@@ -29,8 +29,10 @@ class SqlInsertCommand extends AbstractCommand
*/
protected function configure()
{
+ parent::configure();
+
$this
- ->addOption('input-dir', null, InputOption::VALUE_REQUIRED, 'The input directory', self::DEFAULT_OUTPUT_DIRECTORY)
+ ->addOption('sql-dir', null, InputOption::VALUE_REQUIRED, 'The SQL files directory', self::DEFAULT_OUTPUT_DIRECTORY)
->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Connection to use. Example: bookstore=mysql:host=127.0.0.1;dbname=test;user=root;password=foobar')
->setName('sql:insert')
->setAliases(array('insert-sql'))
@@ -64,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln($message);
}
});
- $manager->setWorkingDirectory($input->getOption('input-dir'));
+ $manager->setWorkingDirectory($input->getOption('sql-dir'));
$manager->insertSql();
}
Something went wrong with that request. Please try again.