Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: cd2233685a
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (56 sloc) 1.981 kB
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Propel\Generator\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\GraphvizManager;
/**
* @author William Durand <william.durand1@gmail.com>
*/
class GraphvizGenerateCommand extends AbstractCommand
{
const DEFAULT_OUTPUT_DIRECTORY = 'generated-graphviz';
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();
$this
->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory', self::DEFAULT_OUTPUT_DIRECTORY)
->setName('graphviz:generate')
->setDescription('Generate Graphviz files (.dot)')
;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$generatorConfig = new GeneratorConfig(array(
'propel.platform.class' => $input->getOption('platform'),
'propel.packageObjectModel' => true,
));
$filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new GraphvizManager();
$manager->setGeneratorConfig($generatorConfig);
$manager->setSchemas($this->getSchemas($input));
$manager->setLoggerClosure(function($message) use ($input, $output) {
if ($input->getOption('verbose')) {
$output->writeln($message);
}
});
$manager->setWorkingDirectory($input->getOption('output-dir'));
$manager->build();
}
}
Jump to Line
Something went wrong with that request. Please try again.