Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions config/propel.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function($item)
# Connection class. One of the Propel\Runtime\Connection classes
'classname' => 'Propel\Runtime\Connection\ConnectionWrapper',
# The PDO dsn
'dsn' => $item['driver'] . ':host=' . $item['host'] . ';port=' . (empty($item['port']) ? '3306' : $item['port']) . ';dbname=' . $item['database'],
'dsn' => $item['driver'] . ':host=' . $item['host'] . (!empty($item['port']) ? 'port=;'.$item['port'] : '') . ';dbname=' . $item['database'],
'user' => $item['username'],
'password' => $item['password'],
# Driver options. See http' => '//www.php.net/manual/en/pdo.construct.php
Expand All @@ -63,8 +63,13 @@ function($item)
'settings' => [
'charset' => $item['charset'],
#Array of queries to run when the database connection is initialized
'query' => [
'SET NAMES utf8 COLLATE utf8_unicode_ci, COLLATION_CONNECTION = utf8_unicode_ci, COLLATION_DATABASE = utf8_unicode_ci, COLLATION_SERVER = utf8_unicode_ci'
'query' => [ call_user_func(function() use ($item) {
if ($item['driver'] == 'mysql') {
return 'SET NAMES utf8 COLLATE utf8_unicode_ci, COLLATION_CONNECTION = utf8_unicode_ci, COLLATION_DATABASE = utf8_unicode_ci, COLLATION_SERVER = utf8_unicode_ci';
} elseif ($item['driver'] == 'pgsql') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use identical comparison and Yoda conditions please. Just «push -f» commit to your repo and pr will updates. And i will merge it.

return "SET NAMES 'UTF8'";
}
})
],
],
'slaves' => [
Expand Down Expand Up @@ -321,4 +326,4 @@ function($item) {
],
],
],
];
];