Driver.php 1.42 KB
Newer Older
1
<?php
2

Michael Moravec's avatar
Michael Moravec committed
3 4
declare(strict_types=1);

5 6
namespace Doctrine\DBAL;

7
use Doctrine\DBAL\Driver\Connection as DriverConnection;
8 9 10
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;

11 12 13 14
/**
 * Driver interface.
 * Interface that all DBAL drivers must implement.
 */
15
interface Driver
16 17 18 19
{
    /**
     * Attempts to create a connection with the database.
     *
20 21 22 23
     * @param mixed[] $params        All connection parameters passed by the user.
     * @param string  $username      The username to use when connecting.
     * @param string  $password      The password to use when connecting.
     * @param mixed[] $driverOptions The driver options to use when connecting.
24
     *
25
     * @return DriverConnection The database connection.
26
     */
27 28 29 30 31 32
    public function connect(
        array $params,
        string $username = '',
        string $password = '',
        array $driverOptions = []
    ) : DriverConnection;
33

34 35 36 37
    /**
     * Gets the DatabasePlatform instance that provides all the metadata about
     * the platform this driver connects to.
     *
38
     * @return AbstractPlatform The database platform.
39
     */
40
    public function getDatabasePlatform() : AbstractPlatform;
41

42 43 44 45
    /**
     * Gets the SchemaManager that can be used to inspect and change the underlying
     * database schema of the platform this driver connects to.
     */
46
    public function getSchemaManager(Connection $conn) : AbstractSchemaManager;
Benjamin Eberlei's avatar
Benjamin Eberlei committed
47
}