Infer the platform class name from the configuration
This commit is contained in:
parent
23c05811d7
commit
a9977bbcc4
|
@ -186,7 +186,7 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
), $parameters);
|
), $parameters);
|
||||||
|
|
||||||
if ($input->hasOption('platform')) {
|
if ($input->hasOption('platform')) {
|
||||||
$parameters['--platform'] = $input->getOption('platform');
|
$parameters['--platform'] = $input->getOption('platform') ?: $this->getPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
$command->setApplication($this->getApplication());
|
$command->setApplication($this->getApplication());
|
||||||
|
@ -339,4 +339,17 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
|
|
||||||
return $config['generator']['defaultConnection'];
|
return $config['generator']['defaultConnection'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the platform class from the configuration
|
||||||
|
*
|
||||||
|
* @return 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue