From abf1ecaf06d4fb211fb90c1045cacd96a1560c5b Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:48:50 -0400 Subject: [PATCH] Better naming classes with `PDO` - part 1. (#211) --- src/{CommandPDO.php => Command.php} | 2 +- src/{ConnectionPDO.php => Connection.php} | 6 +++--- src/{PDODriver.php => Driver.php} | 2 +- src/{TransactionPDO.php => Transaction.php} | 2 +- tests/CommandTest.php | 6 +++--- tests/Support/TestTrait.php | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) rename src/{CommandPDO.php => Command.php} (98%) rename src/{ConnectionPDO.php => Connection.php} (95%) rename src/{PDODriver.php => Driver.php} (91%) rename src/{TransactionPDO.php => Transaction.php} (84%) diff --git a/src/CommandPDO.php b/src/Command.php similarity index 98% rename from src/CommandPDO.php rename to src/Command.php index 1f4e37a..fe0cde6 100644 --- a/src/CommandPDO.php +++ b/src/Command.php @@ -23,7 +23,7 @@ * Implements a database command that can be executed against a PDO (PHP Data Object) database connection for Oracle * Server. */ -final class CommandPDO extends AbstractCommandPDO +final class Command extends AbstractCommandPDO { public function insertWithReturningPks(string $table, array $columns): bool|array { diff --git a/src/ConnectionPDO.php b/src/Connection.php similarity index 95% rename from src/ConnectionPDO.php rename to src/Connection.php index a201688..c1104bd 100644 --- a/src/ConnectionPDO.php +++ b/src/Connection.php @@ -21,11 +21,11 @@ * * @link https://www.php.net/manual/en/ref.pdo-oci.php */ -final class ConnectionPDO extends AbstractConnectionPDO +final class Connection extends AbstractConnectionPDO { public function createCommand(string $sql = null, array $params = []): CommandPDOInterface { - $command = new CommandPDO($this); + $command = new Command($this); if ($sql !== null) { $command->setSql($sql); @@ -44,7 +44,7 @@ public function createCommand(string $sql = null, array $params = []): CommandPD public function createTransaction(): TransactionInterface { - return new TransactionPDO($this); + return new Transaction($this); } /** diff --git a/src/PDODriver.php b/src/Driver.php similarity index 91% rename from src/PDODriver.php rename to src/Driver.php index e7ec22d..422b433 100644 --- a/src/PDODriver.php +++ b/src/Driver.php @@ -12,7 +12,7 @@ * * @see https://www.php.net/manual/en/ref.pdo-oci.php */ -final class PDODriver extends AbstractPDODriver +final class Driver extends AbstractPDODriver { public function createConnection(): PDO { diff --git a/src/TransactionPDO.php b/src/Transaction.php similarity index 84% rename from src/TransactionPDO.php rename to src/Transaction.php index 18f8390..cdfacb0 100644 --- a/src/TransactionPDO.php +++ b/src/Transaction.php @@ -9,7 +9,7 @@ /** * Implements the Oracle Server specific transaction. */ -final class TransactionPDO extends AbstractTransactionPDO +final class Transaction extends AbstractTransactionPDO { public function releaseSavepoint(string $name): void { diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 460948a..80c0d44 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -11,9 +11,9 @@ use Yiisoft\Db\Exception\InvalidCallException; use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Exception\NotSupportedException; -use Yiisoft\Db\Oracle\ConnectionPDO; +use Yiisoft\Db\Oracle\Connection; use Yiisoft\Db\Oracle\Dsn; -use Yiisoft\Db\Oracle\PDODriver; +use Yiisoft\Db\Oracle\Driver; use Yiisoft\Db\Oracle\Tests\Support\TestTrait; use Yiisoft\Db\Query\Query; use Yiisoft\Db\Schema\SchemaInterface; @@ -575,7 +575,7 @@ public function testProfilerData(string $sql = null): void public function testShowDatabases(): void { $dsn = new Dsn('oci', 'localhost'); - $db = new ConnectionPDO(new PDODriver($dsn->asString(), 'SYSTEM', 'root'), DbHelper::getSchemaCache()); + $db = new Connection(new Driver($dsn->asString(), 'SYSTEM', 'root'), DbHelper::getSchemaCache()); $command = $db->createCommand(); diff --git a/tests/Support/TestTrait.php b/tests/Support/TestTrait.php index 9e55bc4..f0471c5 100644 --- a/tests/Support/TestTrait.php +++ b/tests/Support/TestTrait.php @@ -7,9 +7,9 @@ use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidConfigException; -use Yiisoft\Db\Oracle\ConnectionPDO; +use Yiisoft\Db\Oracle\Connection; use Yiisoft\Db\Oracle\Dsn; -use Yiisoft\Db\Oracle\PDODriver; +use Yiisoft\Db\Oracle\Driver; use Yiisoft\Db\Tests\Support\DbHelper; trait TestTrait @@ -22,7 +22,7 @@ trait TestTrait */ protected function getConnection(bool $fixture = false): ConnectionPDOInterface { - $db = new ConnectionPDO(new PDODriver($this->getDsn(), 'system', 'root'), DbHelper::getSchemaCache()); + $db = new Connection(new Driver($this->getDsn(), 'system', 'root'), DbHelper::getSchemaCache()); if ($fixture) { DbHelper::loadFixture($db, __DIR__ . '/Fixture/oci.sql'); @@ -35,7 +35,7 @@ protected static function getDb(): ConnectionPDOInterface { $dsn = (new Dsn('oci', 'localhost', 'XE', '1521', ['charset' => 'AL32UTF8']))->asString(); - return new ConnectionPDO(new PDODriver($dsn, 'system', 'root'), DbHelper::getSchemaCache()); + return new Connection(new Driver($dsn, 'system', 'root'), DbHelper::getSchemaCache()); } protected function getDsn(): string