Skip to content

Commit

Permalink
Improved commands
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Jun 22, 2011
1 parent 4f1cc4c commit 35a56e8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Command/BuildModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('verbose')) {
$this->additionalPhingArgs[]= 'verbose';
$this->additionalPhingArgs[] = 'verbose';
}

if (true === $this->callPhing('om')) {
$this->writeSection($output, '[Propel] You are running the command: propel:build-model');

foreach ($this->tempSchemas as $schemaFile => $schemaDetails) {
$output->writeln(sprintf(
'Built Model classes for bundle <info>%s</info> from <comment>%s</comment>.',
Expand Down
4 changes: 3 additions & 1 deletion Command/BuildSqlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('verbose')) {
$this->additionalPhingArgs[]= 'verbose';
$this->additionalPhingArgs[] = 'verbose';
}

if (true === $this->callPhing('sql', array('propel.packageObjectModel' => false))) {
$this->writeSection($output, '[Propel] You are running the command: propel:build-sql');

$filesystem = new Filesystem();
$basePath = $this->getApplication()->getKernel()->getRootDir(). DIRECTORY_SEPARATOR . 'propel'. DIRECTORY_SEPARATOR . 'sql';
$sqlMap = file_get_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map');
Expand Down
2 changes: 2 additions & 0 deletions Command/DatabaseCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->writeSection($output, '[Propel] You are running the command: propel:database:create');

list($name, $config) = $this->getConnection($input, $output);
$dbName = $this->parseDbName($config['connection']['dsn']);
$query = 'CREATE DATABASE '. $dbName .';';
Expand Down
2 changes: 2 additions & 0 deletions Command/DatabaseDropCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('force')) {
$this->writeSection($output, '[Propel] You are running the command: propel:database:drop');

list($name, $config) = $this->getConnection($input, $output);
$dbName = $this->parseDbName($config['connection']['dsn']);
$query = 'DROP DATABASE '. $dbName .';';
Expand Down
2 changes: 2 additions & 0 deletions Command/InsertSqlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('force')) {
$this->writeSection($output, '[Propel] You are running the command: propel:insert-sql');

list($name, $defaultConfig) = $this->getConnection($input, $output);

$ret = $this->callPhing('insert-sql', array(
Expand Down
8 changes: 4 additions & 4 deletions Command/LoadFixturesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->writeSection($output, '[Propel] You are running the command: propel:load-fixtures');

$this->absoluteFixturesPath = $this->getApplication()->getKernel()->getRootDir() . DIRECTORY_SEPARATOR . $input->getOption('dir');
$this->filesystem = new Filesystem();

$noOptions = (!$input->getOption('xml') && !$input->getOption('sql'));

if ($input->getOption('xml') || $noOptions)
{
if ($input->getOption('xml') || $noOptions) {
$this->loadXmlFixtures($input, $output);
}

if ($input->getOption('sql') || $noOptions)
{
if ($input->getOption('sql') || $noOptions) {
$this->loadSqlFixtures($input, $output);
}

Expand Down

0 comments on commit 35a56e8

Please sign in to comment.