Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
7dcfdbde
Unverified
Commit
7dcfdbde
authored
Apr 15, 2019
by
Michael Moravec
Committed by
Sergei Morozov
Nov 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated MysqlSessionInit listener
parent
7f6e19f1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
93 deletions
+1
-93
UPGRADE.md
UPGRADE.md
+1
-0
MysqlSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
+0
-60
MysqlSessionInitTest.php
tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
+0
-33
No files found.
UPGRADE.md
View file @
7dcfdbde
...
...
@@ -5,6 +5,7 @@
*
Removed
`json_array`
type and all associated hacks.
*
Removed
`Connection::TRANSACTION_*`
constants.
*
Removed
`AbstractPlatform::DATE_INTERVAL_UNIT_*`
and
`AbstractPlatform::TRIM_*`
constants.
*
Removed
`MysqlSessionInit`
listener.
## BC BREAK `Connection::ping()` returns `void`.
...
...
lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
deleted
100644 → 0
View file @
7f6e19f1
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Event\Listeners
;
use
Doctrine\Common\EventSubscriber
;
use
Doctrine\DBAL\Event\ConnectionEventArgs
;
use
Doctrine\DBAL\Events
;
/**
* MySQL Session Init Event Subscriber which allows to set the Client Encoding of the Connection.
*
* @deprecated Use "charset" option to PDO MySQL Connection instead.
*/
class
MysqlSessionInit
implements
EventSubscriber
{
/**
* The charset.
*
* @var string
*/
private
$charset
;
/**
* The collation, or FALSE if no collation.
*
* @var string|bool
*/
private
$collation
;
/**
* Configure Charset and Collation options of MySQL Client for each Connection.
*
* @param string $charset The charset.
* @param string|bool $collation The collation, or FALSE if no collation.
*/
public
function
__construct
(
$charset
=
'utf8'
,
$collation
=
false
)
{
$this
->
charset
=
$charset
;
$this
->
collation
=
$collation
;
}
/**
* @return void
*/
public
function
postConnect
(
ConnectionEventArgs
$args
)
{
$collation
=
$this
->
collation
?
' COLLATE '
.
$this
->
collation
:
''
;
$args
->
getConnection
()
->
executeUpdate
(
'SET NAMES '
.
$this
->
charset
.
$collation
);
}
/**
* {@inheritdoc}
*/
public
function
getSubscribedEvents
()
{
return
[
Events
::
postConnect
];
}
}
tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
deleted
100644 → 0
View file @
7f6e19f1
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\Tests\DBAL\Events
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Event\ConnectionEventArgs
;
use
Doctrine\DBAL\Event\Listeners\MysqlSessionInit
;
use
Doctrine\DBAL\Events
;
use
Doctrine\Tests\DbalTestCase
;
class
MysqlSessionInitTest
extends
DbalTestCase
{
public
function
testPostConnect
()
:
void
{
$connectionMock
=
$this
->
createMock
(
Connection
::
class
);
$connectionMock
->
expects
(
$this
->
once
())
->
method
(
'executeUpdate'
)
->
with
(
$this
->
equalTo
(
'SET NAMES foo COLLATE bar'
));
$eventArgs
=
new
ConnectionEventArgs
(
$connectionMock
);
$listener
=
new
MysqlSessionInit
(
'foo'
,
'bar'
);
$listener
->
postConnect
(
$eventArgs
);
}
public
function
testGetSubscribedEvents
()
:
void
{
$listener
=
new
MysqlSessionInit
();
self
::
assertEquals
([
Events
::
postConnect
],
$listener
->
getSubscribedEvents
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment