ConnectionEventArgs.php 1.41 KB
Newer Older
1 2 3 4
<?php

namespace Doctrine\DBAL\Event;

Benjamin Morel's avatar
Benjamin Morel committed
5 6
use Doctrine\Common\EventArgs;
use Doctrine\DBAL\Connection;
7 8 9
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
10 11 12 13 14 15

/**
 * Event Arguments used when a Driver connection is established inside Doctrine\DBAL\Connection.
 */
class ConnectionEventArgs extends EventArgs
{
16
    /** @var Connection */
17
    private $connection;
18 19 20

    public function __construct(Connection $connection)
    {
21
        $this->connection = $connection;
22 23 24
    }

    /**
25
     * @return Connection
26 27 28
     */
    public function getConnection()
    {
29
        return $this->connection;
30 31 32
    }

    /**
33 34
     * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDriver() instead.
     *
35
     * @return Driver
36 37 38
     */
    public function getDriver()
    {
39
        return $this->connection->getDriver();
40 41 42
    }

    /**
43 44
     * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDatabasePlatform() instead.
     *
45
     * @return AbstractPlatform
46 47 48
     */
    public function getDatabasePlatform()
    {
49
        return $this->connection->getDatabasePlatform();
50 51 52
    }

    /**
53 54
     * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getSchemaManager() instead.
     *
55
     * @return AbstractSchemaManager
56 57 58
     */
    public function getSchemaManager()
    {
59
        return $this->connection->getSchemaManager();
60 61
    }
}