<?php
namespace IST\DoctrineFirebirdDriver\Driver\FirebirdInterbase;
use Doctrine\DBAL\DBALException;
use IST\DoctrineFirebirdDriver\Driver\AbstractFirebirdInterbaseDriver;
use IST\DoctrineFirebirdDriver\Driver\FirebirdInterbase\Configuration;
class Driver extends AbstractFirebirdInterbaseDriver
{
public function __construct()
{
parent::__construct();
if ($this->configuration == null) {
if (empty($_ENV['DB_NAME'])) {
throw new Exception('"DB_NAME" değeri geçersiz!');
}
$this->configuration = new Configuration(
$_ENV['DB_HOST'] ?? 'localhost',
$_ENV['DB_PORT'] ?? 3050,
$_ENV['DB_NAME'],
$_ENV['DB_USER'] ?? 'SYSDBA',
$_ENV['DB_PASSWORD'] ?? 'masterkey',
$_ENV['DB_CHARSET'] ?? 'UTF-8',
0,
$_ENV['DB_DIALECT'] ?? 3
);
}
}
/**
* @param array $params N/A.
* @param ?string $username N/A.
* @param ?string $password N/A.
* @param array $driverOptions N/A.
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
try {
return new Connection($this->configuration);
} catch (Exception $e) {
throw DBALException::driverException($this, $e);
}
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'FirebirdInterbase';
}
}