-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\PDO:: class constant aliases (request) #13010
Comments
Well, this is from Phalcon's config object and toArray() method: Array
(
[host] => db.lxc
[username] => myUser
[password] => myPass
[dbname] => myDb
[charset] => UTF8
[persistent] => 1
[options] => Array
(
[19] => 5
)
)
//19 => 5 originally was set as: \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_OBJ and vanilla PHP:
So those constants will always be converted internally to integer values, since that's what they are - you're using constant name in order to get it's value. |
I know. Thats why im asking to add the alias feature.
Test
Works fine. I just dont have enough knowledge about zep to provide a PR. |
* Allow PDO option aliases See #13010 * fixing syntax error
Implemented in the |
* Allow PDO option aliases See phalcon#13010 * fixing syntax error
By merging multiple service configs like
we got a problem with numeric keys (integer).
F.e.
\PDO::MYSQL_ATTR_INIT_COMMAND
=== 1002.So we get a actual config of:
In PHP if merging multiple configs we get renumbered keys ofc.
Example:
The fatal here is that the key
0
will end up as a "AUTOCOMMIT=0".To tmp fix that we can force keys to strings like
To fix this perm i suggest allowing aliasses.
mysql_attr_init_command
for\PDO::MYSQL_ATTR_INIT_COMMAND
.Im not into zephir. I cannot provide a PR. But i can provide the code in PHP.
Would be nice if somebody could convert that into zep for me.
Where to put:
https://github.com/phalcon/cphalcon/blob/master/phalcon/db/adapter/pdo.zep#L130
What to put:
Thanks,
cottton
The text was updated successfully, but these errors were encountered: