propel-bundle/Command/ModelBuildCommand.php

60 lines
1.5 KiB
PHP
Raw Normal View History

2013-10-31 22:05:29 +01:00
<?php
/**
* This file is part of the PropelBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
2016-02-11 19:14:03 +01:00
namespace Propel\Bundle\PropelBundle\Command;
2013-10-31 22:05:29 +01:00
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
2013-10-31 22:05:29 +01:00
use Symfony\Component\Console\Input\InputInterface;
2013-12-15 15:04:11 +01:00
use Propel\Generator\Command\ModelBuildCommand as BaseModelBuildCommand;
2013-10-31 22:05:29 +01:00
/**
* @author Kévin Gomez <contact@kevingomez.fr>
*/
2013-11-24 17:36:58 +01:00
class ModelBuildCommand extends WrappedCommand
2013-10-31 22:05:29 +01:00
{
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();
$this
->setName('propel:model:build')
->setDescription('Build the model classes based on Propel XML schemas')
->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Connection to use. Example: default, bookstore')
2013-10-31 22:05:29 +01:00
->addArgument('bundle', InputArgument::OPTIONAL, 'The bundle to generate model classes from')
;
}
/**
* {@inheritdoc}
*/
protected function createSubCommandInstance()
{
2013-12-15 15:04:11 +01:00
return new BaseModelBuildCommand();
2013-10-31 22:05:29 +01:00
}
/**
* {@inheritdoc}
*/
protected function getSubCommandArguments(InputInterface $input)
{
2013-12-15 15:04:11 +01:00
$outputDir = $this->getApplication()->getKernel()->getRootDir().'/../';
2013-10-31 22:05:29 +01:00
return array(
'--output-dir' => $outputDir,
);
}
}