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 .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
php: ['8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

name: PHP ${{ matrix.php }}

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"type": "library",
"license": "BSD-3-Clause",
"require": {
"php": ">=7.1"
"php": ">=8.0"
},
"require-dev": {
"dibi/dibi": "^3.0 || ^4.0 || ^5.0",
"dibi/dibi": "^4.0 || ^5.0",
"doctrine/cache": "^1.11",
"doctrine/dbal": "^2.5 || ^3.0 || ^4.0",
"doctrine/dbal": "^2.12 || ^3.0 || ^4.0",
"doctrine/doctrine-bundle": "^2.0 || ^3.0",
"doctrine/orm": "^2.7 || ^3.0",
"mockery/mockery": "^1.3",
"nette/database": "^2.4 || ^3.0",
"nette/di": "^2.4 || ^3.0",
"nette/tester": "^2.3",
"nette/utils": "^2.3 || ^3.0 || ^4.0",
"nextras/dbal": "^1.0 || ^2.0 || ^3.0 || ^4.0 || ^5.0",
"nextras/dbal": "^4.0 || ^5.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0 || ^8.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0 || ^8.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0 || ^8.0",
Expand Down
16 changes: 0 additions & 16 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@ x-php-service-base: &php-service-base
PHP_EXTENSION_PDO_PGSQL: 1

services:
php71:
<<: *php-service-base
image: thecodingmachine/php:7.1-v3-cli

php72:
<<: *php-service-base
image: thecodingmachine/php:7.2-v4-cli

php73:
<<: *php-service-base
image: thecodingmachine/php:7.3-v4-cli

php74:
<<: *php-service-base
image: thecodingmachine/php:7.4-v5-cli

php80:
<<: *php-service-base
image: thecodingmachine/php:8.0-v5-cli
Expand Down
73 changes: 0 additions & 73 deletions src/Bridges/Dibi/Dibi3Adapter.php

This file was deleted.

35 changes: 14 additions & 21 deletions src/Bridges/Dibi/DibiAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,61 @@
namespace Nextras\Migrations\Bridges\Dibi;

use DateTimeInterface;
use dibi;
use Dibi\Connection;
use LogicException;
use Dibi;
use Nextras\Migrations\IDbal;


class DibiAdapter implements IDbal
{
/** @var IDbal */
private $innerAdapter;


public function __construct(Connection $conn)
public function __construct(
private Dibi\Connection $conn,
)
{
if (version_compare(dibi::VERSION, '3.0.0', '>=')) {
$this->innerAdapter = new Dibi3Adapter($conn);

} else {
throw new LogicException('Unsupported dibi version');
}
}


public function query(string $sql): array
{
return $this->innerAdapter->query($sql);
$result = $this->conn->nativeQuery($sql);
$result->setRowClass(null);
return $result->fetchAll();
}


public function exec(string $sql): int
{
return $this->innerAdapter->exec($sql);
$this->conn->nativeQuery($sql);
return $this->conn->getAffectedRows();
}


public function escapeString(string $value): string
{
return $this->innerAdapter->escapeString($value);
return $this->conn->getDriver()->escapeText($value);
}


public function escapeInt(int $value): string
{
return $this->innerAdapter->escapeInt($value);
return (string) $value;
}


public function escapeBool(bool $value): string
{
return $this->innerAdapter->escapeBool($value);
return (string) $this->conn->getDriver()->escapeBool($value);
}


public function escapeDateTime(DateTimeInterface $value): string
{
return $this->innerAdapter->escapeDateTime($value);
return $this->conn->getDriver()->escapeDateTime($value);
}


public function escapeIdentifier(string $value): string
{
return $this->innerAdapter->escapeIdentifier($value);
return $this->conn->getDriver()->escapeIdentifier($value);
}

}
17 changes: 5 additions & 12 deletions src/Bridges/DoctrineDbal/DoctrineAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,22 @@

class DoctrineAdapter implements IDbal
{
/** @var Doctrine\DBAL\Connection */
private $conn;


public function __construct(Doctrine\DBAL\Connection $conn)
public function __construct(
private Doctrine\DBAL\Connection $conn,
)
{
$this->conn = $conn;
}


public function query(string $sql): array
{
return method_exists($this->conn, 'fetchAllAssociative')
? $this->conn->fetchAllAssociative($sql)
: $this->conn->fetchAll($sql);
return $this->conn->fetchAllAssociative($sql);
}


public function exec(string $sql): int
{
return method_exists($this->conn, 'executeStatement')
? $this->conn->executeStatement($sql)
: $this->conn->exec($sql);
return $this->conn->executeStatement($sql);
}


Expand Down
22 changes: 8 additions & 14 deletions src/Bridges/DoctrineOrm/StructureDiffGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@

class StructureDiffGenerator implements IDiffGenerator
{
/** @var EntityManagerInterface */
private $entityManager;

/** @var string|null absolute path to a file */
private $ignoredQueriesFile;


public function __construct(EntityManagerInterface $entityManager, ?string $ignoredQueriesFile = null)
/**
* @param string|null $ignoredQueriesFile absolute path to a file
*/
public function __construct(
private EntityManagerInterface $entityManager,
private ?string $ignoredQueriesFile = null,
)
{
$this->entityManager = $entityManager;
$this->ignoredQueriesFile = $ignoredQueriesFile;
}


Expand All @@ -52,10 +49,7 @@ public function generateContent(): string
*/
protected function getUpdateQueries(): array
{
$cache = $this->entityManager->getConfiguration()->getMetadataCache();
if ($cache !== null) {
$cache->clear();
}
$this->entityManager->getConfiguration()->getMetadataCache()?->clear();

$schemaTool = new SchemaTool($this->entityManager);
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
Expand Down
Loading