Fixed AbstractCommand to work with newest Propel2 version. Added option index_property back to ModelType.

Basically copied newest changes from propelv1 symfony bridge to ModelChoiceList to have more fixes included.
Fixed also some typehints.
This commit is contained in:
Marc J. Schmidt 2014-11-20 10:59:40 +01:00
commit 6f3ad8f373
6 changed files with 246 additions and 159 deletions

View file

@ -31,7 +31,7 @@ abstract class AbstractCommand extends ContainerAwareCommand
protected $cacheDir = null;
/**
* @var Symfony\Component\HttpKernel\Bundle\BundleInterface
* @var \Symfony\Component\HttpKernel\Bundle\BundleInterface
*/
protected $bundle = null;
@ -180,10 +180,19 @@ abstract class AbstractCommand extends ContainerAwareCommand
array_unshift($parameters, $this->getName());
// merge the default parameters
$parameters = array_merge(array(
'--input-dir' => $this->cacheDir,
'--verbose' => $input->getOption('verbose'),
), $parameters);
$extraParameters = [
'--verbose' => $input->getOption('verbose')
];
if ($command->getDefinition()->hasOption('schema-dir')) {
$extraParameters['--schema-dir'] = $this->cacheDir;
}
if ($command->getDefinition()->hasOption('config-dir')) {
$extraParameters['--config-dir'] = $this->cacheDir;
}
$parameters = array_merge($extraParameters, $parameters);
if ($input->hasOption('platform')) {
$parameters['--platform'] = $input->getOption('platform') ?: $this->getPlatform();
@ -343,13 +352,11 @@ abstract class AbstractCommand extends ContainerAwareCommand
/**
* Reads the platform class from the configuration
*
* @return The platform class name.
* @return string The platform class name.
*/
protected function getPlatform()
{
$config = $this->getContainer()->getParameter('propel.configuration');
$className = $config['generator']['platformClass'];
return ($pos = strrpos($className, '\\')) === false ? $className : substr($className, $pos + 1);
return $config['generator']['platformClass'];
}
}