MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
MysqlSessionInit.php
Ir para a documentação deste ficheiro.
1
<?php
2
/*
3
* $Id$
4
*
5
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
*
17
* This software consists of voluntary contributions made by many individuals
18
* and is licensed under the LGPL. For more information, see
19
* <http://www.doctrine-project.org>.
20
*/
21
22
namespace
Doctrine\DBAL\Event\Listeners
;
23
24
use
Doctrine\DBAL\Event\ConnectionEventArgs
;
25
use
Doctrine\DBAL\Events
;
26
use
Doctrine\Common\EventSubscriber
;
27
37
class
MysqlSessionInit
implements
EventSubscriber
38
{
42
private
$_charset;
43
47
private
$_collation;
48
55
public
function
__construct
(
$charset
=
'utf8'
, $collation =
false
)
56
{
57
$this->_charset =
$charset
;
58
$this->_collation = $collation;
59
}
60
65
public
function
postConnect
(
ConnectionEventArgs
$args)
66
{
67
$collation = ($this->_collation) ?
" COLLATE "
.$this->_collation :
""
;
68
$args->
getConnection
()->executeUpdate(
"SET NAMES "
.$this->_charset . $collation);
69
}
70
71
public
function
getSubscribedEvents
()
72
{
73
return
array(
Events::postConnect
);
74
}
75
}
Doctrine\DBAL\Event\ConnectionEventArgs
Definição
ConnectionEventArgs.php:37
Doctrine\DBAL\Event\ConnectionEventArgs\getConnection
getConnection()
Definição
ConnectionEventArgs.php:51
Doctrine\DBAL\Event\Listeners\MysqlSessionInit
Definição
MysqlSessionInit.php:38
Doctrine\DBAL\Event\Listeners\MysqlSessionInit\postConnect
postConnect(ConnectionEventArgs $args)
Definição
MysqlSessionInit.php:65
Doctrine\DBAL\Event\Listeners\MysqlSessionInit\getSubscribedEvents
getSubscribedEvents()
Definição
MysqlSessionInit.php:71
Doctrine\DBAL\Event\Listeners\MysqlSessionInit\__construct
__construct($charset='utf8', $collation=false)
Definição
MysqlSessionInit.php:55
Doctrine\DBAL\Events
Definição
Events.php:33
Doctrine\DBAL\Events\postConnect
const postConnect
Definição
Events.php:36
Doctrine\Common\EventSubscriber
Definição
EventSubscriber.php:38
Doctrine\DBAL\Event\Listeners
Definição
MysqlSessionInit.php:22
$charset
$charset
Definição
base.php:7
classes
extensions
doctrine-dbal
Doctrine
DBAL
Event
Listeners
MysqlSessionInit.php
Gerado por
1.10.0