Skip to content

Commit

Permalink
Fixed broken doctrine/dbal broken dependency (#34, NOJIRA)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis authored Jun 20, 2022
1 parent c30962d commit e355ea2
Show file tree
Hide file tree
Showing 33 changed files with 5,698 additions and 25 deletions.
16 changes: 8 additions & 8 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions app/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1330,17 +1330,17 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.6",
"version_normalized": "3.3.6.0",
"version": "3.3.7",
"version_normalized": "3.3.7.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21"
"reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9e7f76dd1cde81c62574fdffa5a9c655c847ad21",
"reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f79d4650430b582f4598fe0954ef4d52fbc0a8a",
"reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a",
"shasum": ""
},
"require": {
Expand All @@ -1355,19 +1355,19 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2022.1",
"phpstan/phpstan": "1.6.3",
"phpstan/phpstan": "1.7.13",
"phpstan/phpstan-strict-rules": "^1.2",
"phpunit/phpunit": "9.5.20",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
"squizlabs/php_codesniffer": "3.7.0",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.23.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"time": "2022-05-02T17:21:01+00:00",
"time": "2022-06-13T21:43:03+00:00",
"bin": [
"bin/doctrine-dbal"
],
Expand Down Expand Up @@ -1424,7 +1424,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.6"
"source": "https://github.com/doctrine/dbal/tree/3.3.7"
},
"funding": [
{
Expand Down
10 changes: 5 additions & 5 deletions app/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '20a630fdda018e7cfdfe697ae7c25d9ac5d9bb20',
'reference' => 'c30962d4b82e0bf29c54e2ea414abd003a620bec',
'name' => 'cakephp/app',
'dev' => true,
),
Expand All @@ -25,7 +25,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '20a630fdda018e7cfdfe697ae7c25d9ac5d9bb20',
'reference' => 'c30962d4b82e0bf29c54e2ea414abd003a620bec',
'dev_requirement' => false,
),
'cakephp/bake' => array(
Expand Down Expand Up @@ -272,12 +272,12 @@
'dev_requirement' => false,
),
'doctrine/dbal' => array(
'pretty_version' => '3.3.6',
'version' => '3.3.6.0',
'pretty_version' => '3.3.7',
'version' => '3.3.7.0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/dbal',
'aliases' => array(),
'reference' => '9e7f76dd1cde81c62574fdffa5a9c655c847ad21',
'reference' => '9f79d4650430b582f4598fe0954ef4d52fbc0a8a',
'dev_requirement' => false,
),
'doctrine/deprecations' => array(
Expand Down
4 changes: 2 additions & 2 deletions app/vendor/doctrine/dbal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2022.1",
"phpstan/phpstan": "1.6.3",
"phpstan/phpstan": "1.7.13",
"phpstan/phpstan-strict-rules": "^1.2",
"phpunit/phpunit": "9.5.20",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
"squizlabs/php_codesniffer": "3.7.0",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.23.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Doctrine\DBAL\Driver\API\SQLite;

use function strpos;

/**
* User-defined SQLite functions.
*
* @internal
*/
final class UserDefinedFunctions
{
/**
* User-defined function that implements MOD().
*
* @param int $a
* @param int $b
*/
public static function mod($a, $b): int
{
return $a % $b;
}

/**
* User-defined function that implements LOCATE().
*
* @param string $str
* @param string $substr
* @param int $offset
*/
public static function locate($str, $substr, $offset = 0): int
{
// SQL's LOCATE function works on 1-based positions, while PHP's strpos works on 0-based positions.
// So we have to make them compatible if an offset is given.
if ($offset > 0) {
$offset -= 1;
}

$pos = strpos($str, $substr, $offset);

if ($pos !== false) {
return $pos + 1;
}

return 0;
}
}
35 changes: 35 additions & 0 deletions app/vendor/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Driver\IBMDB2\Exception;

use Doctrine\DBAL\Driver\AbstractException;

use function preg_match;

/**
* @internal
*
* @psalm-immutable
*/
final class Factory
{
/**
* @param callable(int): T $constructor
*
* @return T
*
* @template T of AbstractException
*/
public static function create(string $message, callable $constructor): AbstractException
{
$code = 0;

if (preg_match('/ SQL(\d+)N /', $message, $matches) === 1) {
$code = -(int) $matches[1];
}

return $constructor($code);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php

namespace Doctrine\DBAL\Driver\Middleware;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\ParameterType;
use Doctrine\Deprecations\Deprecation;
use LogicException;

use function get_class;
use function method_exists;
use function sprintf;

abstract class AbstractConnectionMiddleware implements ServerInfoAwareConnection
{
/** @var Connection */
private $wrappedConnection;

public function __construct(Connection $wrappedConnection)
{
$this->wrappedConnection = $wrappedConnection;
}

public function prepare(string $sql): Statement
{
return $this->wrappedConnection->prepare($sql);
}

public function query(string $sql): Result
{
return $this->wrappedConnection->query($sql);
}

/**
* {@inheritdoc}
*/
public function quote($value, $type = ParameterType::STRING)
{
return $this->wrappedConnection->quote($value, $type);
}

public function exec(string $sql): int
{
return $this->wrappedConnection->exec($sql);
}

/**
* {@inheritdoc}
*/
public function lastInsertId($name = null)
{
if ($name !== null) {
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4687',
'The usage of Connection::lastInsertId() with a sequence name is deprecated.'
);
}

return $this->wrappedConnection->lastInsertId($name);
}

/**
* {@inheritdoc}
*/
public function beginTransaction()
{
return $this->wrappedConnection->beginTransaction();
}

/**
* {@inheritdoc}
*/
public function commit()
{
return $this->wrappedConnection->commit();
}

/**
* {@inheritdoc}
*/
public function rollBack()
{
return $this->wrappedConnection->rollBack();
}

/**
* {@inheritdoc}
*/
public function getServerVersion()
{
if (! $this->wrappedConnection instanceof ServerInfoAwareConnection) {
throw new LogicException('The underlying connection is not a ServerInfoAwareConnection');
}

return $this->wrappedConnection->getServerVersion();
}

/**
* @return resource|object
*/
public function getNativeConnection()
{
if (! method_exists($this->wrappedConnection, 'getNativeConnection')) {
throw new LogicException(sprintf(
'The driver connection %s does not support accessing the native connection.',
get_class($this->wrappedConnection)
));
}

return $this->wrappedConnection->getNativeConnection();
}
}
Loading

0 comments on commit e355ea2

Please sign in to comment.