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
a2f1af72
Unverified
Commit
a2f1af72
authored
Apr 15, 2019
by
Michael Moravec
Committed by
Sergei Morozov
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated MysqlSessionInit listener
parent
f3828fbd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
94 deletions
+1
-94
UPGRADE.md
UPGRADE.md
+1
-0
MysqlSessionInit.php
src/Event/Listeners/MysqlSessionInit.php
+0
-63
MysqlSessionInitTest.php
tests/Events/MysqlSessionInitTest.php
+0
-31
No files found.
UPGRADE.md
View file @
a2f1af72
...
...
@@ -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 changes the `Driver::connect()` signature
...
...
src/Event/Listeners/MysqlSessionInit.php
deleted
100644 → 0
View file @
f3828fbd
<?php
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
)
{
$statement
=
'SET NAMES '
.
$this
->
charset
;
if
(
$this
->
collation
!==
false
)
{
$statement
.=
' COLLATE '
.
$this
->
collation
;
}
$args
->
getConnection
()
->
executeUpdate
(
$statement
);
}
/**
* {@inheritdoc}
*/
public
function
getSubscribedEvents
()
{
return
[
Events
::
postConnect
];
}
}
tests/Events/MysqlSessionInitTest.php
deleted
100644 → 0
View file @
f3828fbd
<?php
namespace
Doctrine\DBAL\Tests\Events
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Event\ConnectionEventArgs
;
use
Doctrine\DBAL\Event\Listeners\MysqlSessionInit
;
use
Doctrine\DBAL\Events
;
use
PHPUnit\Framework\TestCase
;
class
MysqlSessionInitTest
extends
TestCase
{
public
function
testPostConnect
()
:
void
{
$connectionMock
=
$this
->
createMock
(
Connection
::
class
);
$connectionMock
->
expects
(
self
::
once
())
->
method
(
'executeUpdate'
)
->
with
(
self
::
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