Open farhanrahman opened 9 years ago
Yes, we have in database:reserver command already some code which makes it possible to pass for --connection
a connection name or a dsn. https://github.com/propelorm/Propel2/blob/master/src/Propel/Generator/Command/DatabaseReverseCommand.php#L60
Although DatabaseReserve is a bit different than others, we should make everywhere possible to use a connection name or a dsn, which will be auto detected then like in database:reserve.
So from the gitter chat earlier today @Celc discovered a case where trying to access a connection config using the flag --connection results in an error. The yaml configuration file looks like this:
In AbstractCommand the parseConnection method (https://github.com/propelorm/Propel2/blob/master/src/Propel/Generator/Command/AbstractCommand.php#L118) returns a connection with $name as an empty string.
The problem with this happens in trying to finalize the configuration in Symphony's Processor in here
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Config/Definition/Processor.php#L37
I need to dig into Propel's tree builder to know more about this issue. Either way I think it will be better to distinguish between --connection as a dsn and --connection as a configuration from the yaml/json/* file. Perhaps something like --connection_config=default/staging. Moreover it might be better to put a regexp for the connection to alert the user that the connection format is wrong.