ConnectionHelper.php 821 Bytes
Newer Older
1 2 3 4
<?php

namespace Doctrine\DBAL\Tools\Console\Helper;

Benjamin Morel's avatar
Benjamin Morel committed
5
use Doctrine\DBAL\Connection;
6
use Symfony\Component\Console\Helper\Helper;
7 8 9 10 11 12 13

/**
 * Doctrine CLI Connection Helper.
 */
class ConnectionHelper extends Helper
{
    /**
Benjamin Morel's avatar
Benjamin Morel committed
14 15
     * The Doctrine database Connection.
     *
16
     * @var Connection
17 18 19 20
     */
    protected $_connection;

    /**
21
     * @param Connection $connection The Doctrine database Connection.
22 23 24 25 26 27 28
     */
    public function __construct(Connection $connection)
    {
        $this->_connection = $connection;
    }

    /**
Benjamin Morel's avatar
Benjamin Morel committed
29
     * Retrieves the Doctrine database Connection.
30
     *
31
     * @return Connection
32 33 34 35 36 37 38
     */
    public function getConnection()
    {
        return $this->_connection;
    }

    /**
Benjamin Morel's avatar
Benjamin Morel committed
39
     * {@inheritdoc}
40 41 42 43 44
     */
    public function getName()
    {
        return 'connection';
    }
45
}