add ability to set generic PDO attributes#1904
add ability to set generic PDO attributes#1904dereuromark merged 5 commits intocakephp:masterfrom MasterOdin:pdo_attr
Conversation
|
Array with real PDO constant keys would be better than error prone string keys. "attributes" => [
\PDO::ATTR_CASE => \PDO::CASE_LOWER,
\PDO::MYSQL_ATTR_IGNORE_SPACE => 1,
], |
|
I disagree with that. Going that route with using the constant names for keys would lock out JSON and YAML configuration files from using this part of phinx easily as you would be forced to use magic number keys which to me is way worse than strings. For your example, this would be the equivalent JSON object: {
"8": 1,
"1009": 1
}Additionally, it would probably mean that phinx would have to hardcode in the list of attributes for specific drivers so that you don't send
|
|
I agree now, I was not familiar enough with how adapter specific attributes are handled. |
Co-authored-by: Mark Sch. <dereuromark@users.noreply.github.com>
Co-authored-by: othercorey <corey.taylor.fl@gmail.com>
|
Looks good. |
Closes #1844
This allows specifying a list of PDO options that are then set against the connection using the
setAttributemethod. This follows a similar design of the adapter specific options of checking against a specific prefix. This is BC breaking in that it reservesattr_for options, but there is no option with that value so it should not affect anyone's code unless they were adding extraneous things to their config.I've also added documentation on setting these options, both the generic ones and the adapter specific ones with a simple example, as I could not find a mention of it before in the docs.