Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/migrate
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use Gt\Cli\Application;
use Gt\Cli\Argument\CommandArgumentList;
use Gt\Database\Cli\ExecuteCommand;
use GT\Database\Cli\ExecuteCommand;

// The script must be run from the context of a project's root directory.
foreach([ __DIR__ . "/../../..", __DIR__ . "/../vendor" ] as $vendor) {
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@

"autoload": {
"psr-4": {
"GT\\Database\\": "./src",
"Gt\\Database\\": "./src"
}
},
"autoload-dev": {
"psr-4": {
"GT\\Database\\Test\\": "./test/phpunit",
"Gt\\Database\\Test\\": "./test/phpunit"
}
},
Expand Down
2 changes: 1 addition & 1 deletion example/01-quick-start.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
use Gt\Database\Result\Row;
use GT\Database\Result\Row;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/05-database-migrations.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Migration\Migrator;
use GT\Database\Connection\Settings;
use GT\Database\Migration\Migrator;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/06-multiple-connections.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\Database;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/07-php-query-collections.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\Database;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/08-sqlbuilder-query-collections.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\Database;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/09-sqlbuilder-overrides-and-reports.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\Database;

chdir(dirname(__DIR__));
require "vendor/autoload.php";
Expand Down
4 changes: 2 additions & 2 deletions example/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Gt\Database\Connection\Settings;
use Gt\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\Database;

function createExampleWorkspace(string $exampleName):array {
$workspace = implode(DIRECTORY_SEPARATOR, [
Expand Down
12 changes: 6 additions & 6 deletions src/Cli/ExecuteCommand.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
namespace Gt\Database\Cli;
namespace GT\Database\Cli;

use Gt\Cli\Argument\ArgumentValueList;
use Gt\Cli\Command\Command;
use Gt\Cli\Parameter\Parameter;
use Gt\Config\ConfigFactory;
use Gt\Database\Connection\Settings;
use Gt\Database\Migration\MigrationIntegrityException;
use Gt\Database\Migration\Migrator;
use Gt\Database\StatementExecutionException;
use Gt\Database\StatementPreparationException;
use GT\Database\Connection\Settings;
use GT\Database\Migration\MigrationIntegrityException;
use GT\Database\Migration\Migrator;
use GT\Database\StatementExecutionException;
use GT\Database\StatementPreparationException;

class ExecuteCommand extends Command {
public function run(?ArgumentValueList $arguments = null):int {
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/Connection.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gt\Database\Connection;
namespace GT\Database\Connection;

use PDO;

Expand Down
4 changes: 2 additions & 2 deletions src/Connection/ConnectionNotConfiguredException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Connection;
namespace GT\Database\Connection;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class ConnectionNotConfiguredException extends DatabaseException {}
2 changes: 1 addition & 1 deletion src/Connection/DefaultSettings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Connection;
namespace GT\Database\Connection;

use PDO;

Expand Down
4 changes: 2 additions & 2 deletions src/Connection/Driver.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Gt\Database\Connection;
namespace GT\Database\Connection;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;
use PDO;
use PDOException;

Expand Down
2 changes: 1 addition & 1 deletion src/Connection/ImmutableSettings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /** @noinspection PhpIncompatibleReturnTypeInspection */

namespace Gt\Database\Connection;
namespace GT\Database\Connection;

trait ImmutableSettings {
public function withBaseDirectory(string $baseDirectory):SettingsInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/Settings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Connection;
namespace GT\Database\Connection;

class Settings implements SettingsInterface {
use ImmutableSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/SettingsInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Connection;
namespace GT\Database\Connection;

interface SettingsInterface {
public function getBaseDirectory():string;
Expand Down
18 changes: 9 additions & 9 deletions src/Database.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Gt\Database;

use Gt\Database\Connection\Connection;
use Gt\Database\Connection\DefaultSettings;
use Gt\Database\Connection\Driver;
use Gt\Database\Connection\SettingsInterface;
use Gt\Database\Query\QueryCollection;
use Gt\Database\Query\QueryCollectionFactory;
use Gt\Database\Result\ResultSet;
namespace GT\Database;

use GT\Database\Connection\Connection;
use GT\Database\Connection\DefaultSettings;
use GT\Database\Connection\Driver;
use GT\Database\Connection\SettingsInterface;
use GT\Database\Query\QueryCollection;
use GT\Database\Query\QueryCollectionFactory;
use GT\Database\Result\ResultSet;
use PDOException;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/DatabaseException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database;
namespace GT\Database;

use RuntimeException;

Expand Down
6 changes: 3 additions & 3 deletions src/Fetchable.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
namespace Gt\Database;
namespace GT\Database;

use DateTimeImmutable;
use DateTimeInterface;
use Gt\Database\Result\ResultSet;
use Gt\Database\Result\Row;
use GT\Database\Result\ResultSet;
use GT\Database\Result\Row;

trait Fetchable {
public function fetch(string $queryName, mixed...$bindings):?Row {
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/MigrationDirectoryNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

class MigrationDirectoryNotFoundException extends MigrationException {}
4 changes: 2 additions & 2 deletions src/Migration/MigrationException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

abstract class MigrationException extends DatabaseException {}
2 changes: 1 addition & 1 deletion src/Migration/MigrationFileNameFormatException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

class MigrationFileNameFormatException extends MigrationException {}
2 changes: 1 addition & 1 deletion src/Migration/MigrationIntegrityException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

class MigrationIntegrityException extends MigrationException {}
2 changes: 1 addition & 1 deletion src/Migration/MigrationSequenceOrderException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

class MigrationSequenceOrderException extends MigrationException {}
8 changes: 4 additions & 4 deletions src/Migration/Migrator.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php /** @noinspection ALL */
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

use DirectoryIterator;
use Exception;
use Gt\Database\Database;
use Gt\Database\Connection\Settings;
use Gt\Database\DatabaseException;
use GT\Database\Database;
use GT\Database\Connection\Settings;
use GT\Database\DatabaseException;
use SplFileInfo;
use SplFileObject;

Expand Down
2 changes: 1 addition & 1 deletion src/Migration/SqlStatementSplitter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Migration;
namespace GT\Database\Migration;

use PHPSQLParser\lexer\PHPSQLLexer;

Expand Down
4 changes: 2 additions & 2 deletions src/Query/BaseQueryPathDoesNotExistException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class BaseQueryPathDoesNotExistException extends DatabaseException {
}
4 changes: 2 additions & 2 deletions src/Query/PhpQuery.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\Connection\Driver;
use GT\Database\Connection\Driver;
use Stringable;

class PhpQuery extends Query {
Expand Down
4 changes: 2 additions & 2 deletions src/Query/PhpQueryClassNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class PhpQueryClassNotFoundException extends DatabaseException {
}
4 changes: 2 additions & 2 deletions src/Query/PreparedStatementException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class PreparedStatementException extends DatabaseException {}
6 changes: 3 additions & 3 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use DateTimeInterface;
use Gt\Database\Connection\Connection;
use Gt\Database\Result\ResultSet;
use GT\Database\Connection\Connection;
use GT\Database\Result\ResultSet;
use PDO;
use PDOException;
use PDOStatement;
Expand Down
8 changes: 4 additions & 4 deletions src/Query/QueryCollection.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\Connection\Driver;
use Gt\Database\Fetchable;
use Gt\Database\Result\ResultSet;
use GT\Database\Connection\Driver;
use GT\Database\Fetchable;
use GT\Database\Result\ResultSet;

abstract class QueryCollection {
use Fetchable;
Expand Down
2 changes: 1 addition & 1 deletion src/Query/QueryCollectionClass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

class QueryCollectionClass extends QueryCollection {
}
2 changes: 1 addition & 1 deletion src/Query/QueryCollectionDirectory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

class QueryCollectionDirectory extends QueryCollection {
}
6 changes: 3 additions & 3 deletions src/Query/QueryCollectionFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use DirectoryIterator;
use Gt\Database\Connection\Driver;
use Gt\Database\Database;
use GT\Database\Connection\Driver;
use GT\Database\Database;
use SplFileInfo;

class QueryCollectionFactory {
Expand Down
4 changes: 2 additions & 2 deletions src/Query/QueryCollectionNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class QueryCollectionNotFoundException extends DatabaseException {}
6 changes: 3 additions & 3 deletions src/Query/QueryFactory.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use SplFileInfo;
use DirectoryIterator;
use Exception;
use InvalidArgumentException;
use ReflectionClass;
use Gt\Database\Connection\Driver;
use Gt\Database\Connection\ConnectionNotConfiguredException;
use GT\Database\Connection\Driver;
use GT\Database\Connection\ConnectionNotConfiguredException;

class QueryFactory {
const CLASS_FOR_EXTENSION = [
Expand Down
4 changes: 2 additions & 2 deletions src/Query/QueryFileExtensionException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class QueryFileExtensionException extends DatabaseException {}
4 changes: 2 additions & 2 deletions src/Query/QueryNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Gt\Database\Query;
namespace GT\Database\Query;

use Gt\Database\DatabaseException;
use GT\Database\DatabaseException;

class QueryNotFoundException extends DatabaseException {}
Loading
Loading