aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Doctrine
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2018-11-29 16:41:23 +0100
committerGitHub <noreply@github.com>2018-11-29 16:41:23 +0100
commit39502b4748709948658fd236a1883b902c6fd470 (patch)
treedc7d2ecf643f9c28b75e4fdb5efc121dcafe3536 /src/Wallabag/CoreBundle/Doctrine
parentb878be4cc99fd4927c70b59386cf7a57b33bb381 (diff)
parent877787e5fe6a6545105616968939949b4db81347 (diff)
downloadwallabag-39502b4748709948658fd236a1883b902c6fd470.tar.gz
wallabag-39502b4748709948658fd236a1883b902c6fd470.tar.zst
wallabag-39502b4748709948658fd236a1883b902c6fd470.zip
Merge pull request #3758 from wallabag/dropping-php5
Dropping PHP < 7.1
Diffstat (limited to 'src/Wallabag/CoreBundle/Doctrine')
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php25
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php38
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php2
3 files changed, 1 insertions, 64 deletions
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
deleted file mode 100644
index eb5b203f..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
+++ /dev/null
@@ -1,25 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Driver;
4
5use Doctrine\DBAL\Connection;
6use Doctrine\DBAL\Driver\PDOPgSql\Driver;
7use Wallabag\CoreBundle\Doctrine\DBAL\Schema\CustomPostgreSqlSchemaManager;
8
9/**
10 * This custom driver allow to use a different schema manager
11 * So we can fix the PostgreSQL 10 problem.
12 *
13 * @see https://github.com/wallabag/wallabag/issues/3479
14 * @see https://github.com/doctrine/dbal/issues/2868
15 */
16class CustomPostgreSQLDriver extends Driver
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getSchemaManager(Connection $conn)
22 {
23 return new CustomPostgreSqlSchemaManager($conn);
24 }
25}
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
deleted file mode 100644
index 439ae17d..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Schema;
4
5use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
6use Doctrine\DBAL\Schema\Sequence;
7
8/**
9 * This custom schema manager fix the PostgreSQL 10 problem.
10 *
11 * @see https://github.com/wallabag/wallabag/issues/3479
12 * @see https://github.com/doctrine/dbal/issues/2868
13 */
14class CustomPostgreSqlSchemaManager extends PostgreSqlSchemaManager
15{
16 /**
17 * {@inheritdoc}
18 */
19 protected function _getPortableSequenceDefinition($sequence)
20 {
21 $sequenceName = $sequence['relname'];
22 if ('public' !== $sequence['schemaname']) {
23 $sequenceName = $sequence['schemaname'] . '.' . $sequence['relname'];
24 }
25
26 $query = 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName);
27
28 // the `method_exists` is only to avoid test to fail:
29 // DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection doesn't support the `getServerVersion`
30 if (method_exists($this->_conn->getWrappedConnection(), 'getServerVersion') && (float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) {
31 $query = "SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = " . $this->_conn->quote($sequenceName);
32 }
33
34 $data = $this->_conn->fetchAll($query);
35
36 return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
37 }
38}
diff --git a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
index 7aa2409a..4a3fef3b 100644
--- a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
+++ b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
@@ -2,8 +2,8 @@
2 2
3namespace Wallabag\CoreBundle\Doctrine; 3namespace Wallabag\CoreBundle\Doctrine;
4 4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema; 5use Doctrine\DBAL\Schema\Schema;
6use Doctrine\Migrations\AbstractMigration;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9