3

I'm trying to reverse engineer a database with Propel reverse command. The database I'm trying to connect to requires a SSL certificate, this is how I connect to it in my application:

new PDO(
    'mysql:host=localhost;dbname=blog',
    'root', '', array(PDO::MYSQL_ATTR_SSL_CA => '/path/ssl-cert.crt'
);

My Propel config file:

propel:
  database:
    connections:
      blog:
        adapter: mysql
        classname: Propel\Runtime\Connection\ConnectionWrapper
        dsn: "mysql:host=localhost;dbname=blog"
    user: root
    password:
    options:
      PDO::MYSQL_ATTR_SSL_CA: /path/ssl-cert.crt

I get the following error:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized option "PDO::MYSQL_ATTR_SSL_CA" under "propel.database.connections.gateway.options" 

I read this post: Secure Propel connection, remote MySQL, the first answer link to an old version of Propel, and I also tried the alternative answer, replacing PDO::MYSQL_ATTR_SSL_CA by its integer value. Nothing worked, has anyone had this problem before? What am I missing?

Community
  • 1
  • 1
Tchoupi
  • 14,560
  • 5
  • 37
  • 71

1 Answers1

3

It seems that only ATTR_PERSISTENT option is supported at the moment: PropelConfiguration

It should be fairly easy to fork it and patch with something like:

->arrayNode('options')
    ->children()
        ->booleanNode('ATTR_PERSISTENT')->defaultFalse()->end()
        ->scalarNode('PDO::MYSQL_ATTR_SSL_CA')->end()
    ->end()
->end()

I would recommend to add this scalar node directly in your vendor/propel/propel/src/Propel/Common/Config/PropelConfiguration.php and check if there are any hidden bugs or missing functionality.

Alex Blex
  • 34,704
  • 7
  • 48
  • 75
  • Thank you Alex. Since there seems to be a few more options missing in Propel, I might go with a custom solution. However your answer provides a good pointer toward a solution. – Tchoupi Nov 30 '15 at 14:16