Skip to content

Passing Options to Connection and other Issue #84

@anvaya

Description

@anvaya

Hi,

We were trying to enable SSL for our MySQL connection by setting up PDO::MYSQL_ATTR_SSL_CA and other attributes, turns out there is no way to achieve it using databases.yml. While there seems to be attributes and an a vague "other" option being used in code, nothing gets passed to the actual connection.

lexpress/doctrine1/lib/Doctrine/Connection.php Line 215 in constructor:

$this->options['other'] = array();
if (isset($adapter['other'])) {
    $this->options['other'] = array(Doctrine_Core::ATTR_PERSISTENT => $adapter['persistent']);
}

First of all, if $adaptor["other"] is being checked, not sure why values in $adaptor["other"] are not being passed on to this->options. Secondly, why would $adaptor["other"] guarantee the presence of $adaptor["persistent"] is beyond me. Clearly seems to be an error.

There is also an issue with getOption method code (Line 262). If the option is not set, the code has no return value, making it a method that can be void and returning a value at the same time. Shouldn't it return null or false?

/**
     * getOption
     *
     * Retrieves option
     *
     * @param string $option
     * @return void
     */
    public function getOption($option)
    {
        if (isset($this->options[$option])) {
            return $this->options[$option];
        }
    }

We had to ultimately use the event doctrine.configure_connection in order to add PDO::MYSQL_ATTR_SSL_CA to the connection's other property in order to get the SSL connection. I think there has to be some way to pass additional options to the connection through databases.yml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions