Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run sql:build model:build config:convert post-init #1236

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/Propel/Generator/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function __construct($name = null)
$this->defaultPhpDir = $this->detectDefaultPhpDir();
}


protected function configure()
{
parent::configure();
Expand Down Expand Up @@ -104,7 +103,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$options['schemaDir'] = $consoleHelper->askQuestion('Where do you want to store your schema.xml?', $this->defaultSchemaDir);
$options['phpDir'] = $consoleHelper->askQuestion('Where do you want propel to save the generated php models?', $this->defaultPhpDir);
$options['namespace'] = $consoleHelper->askQuestion('Which namespace should the generated php models use?');


$consoleHelper->writeln('');

if ($isReverseEngineerRequested) {
$options['schema'] = $this->reverseEngineerSchema($consoleHelper->getOutput(), $options);
}
Expand Down Expand Up @@ -225,6 +226,27 @@ private function generateProject(OutputInterface $output, array $options)
$this->writeFile($output, sprintf('%s/schema.xml', $options['schemaDir']), $options['schema']);
$this->writeFile($output, sprintf('%s/propel.%s', getcwd(), $options['format']), $config->render($options));
$this->writeFile($output, sprintf('%s/propel.%s.dist', getcwd(), $options['format']), $distConfig->render($options));

$this->buildSqlAndModelsAndConvertConfig();
}

private function buildSqlAndModelsAndConvertConfig()
{
$this->getApplication()->setAutoExit(false);

$followupCommands = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we call this followUpCommands (I guess the english word for this is "follow up" and thus the camel case version would be "followUp" instead of "followup")

'sql:build',
'model:build',
'config:convert',
];

foreach($followupCommands as $command) {
if (0 !== $this->getApplication()->run(new ArrayInput([$command]))) {
exit(1);
}
}

$this->getApplication()->setAutoExit(true);
}

private function writeFile(OutputInterface $output, $filename, $content)
Expand Down