aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2018-06-14 14:15:07 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2018-06-14 14:15:07 +0200
commit49b4c875985c7b001af711079662dd3684373229 (patch)
treeacc9f383852c9bf33396672135275e0747dd722d /src
parentbfe7a692261760517199a3797191fd214fc2ee6c (diff)
downloadwallabag-49b4c875985c7b001af711079662dd3684373229.tar.gz
wallabag-49b4c875985c7b001af711079662dd3684373229.tar.zst
wallabag-49b4c875985c7b001af711079662dd3684373229.zip
We should able to get the table name unescaped
When we want to perform complex queries to retrieve metadata from the database
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
index eb5ae407..7aa2409a 100644
--- a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
+++ b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
@@ -9,6 +9,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface 10abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
11{ 11{
12 const UN_ESCAPED_TABLE = true;
13
12 /** 14 /**
13 * @var ContainerInterface 15 * @var ContainerInterface
14 */ 16 */
@@ -28,10 +30,14 @@ abstract class WallabagMigration extends AbstractMigration implements ContainerA
28 $this->container = $container; 30 $this->container = $container;
29 } 31 }
30 32
31 protected function getTable($tableName) 33 protected function getTable($tableName, $unEscaped = false)
32 { 34 {
33 $table = $this->container->getParameter('database_table_prefix') . $tableName; 35 $table = $this->container->getParameter('database_table_prefix') . $tableName;
34 36
37 if (self::UN_ESCAPED_TABLE === $unEscaped) {
38 return $table;
39 }
40
35 // escape table name is handled using " on postgresql 41 // escape table name is handled using " on postgresql
36 if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { 42 if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
37 return '"' . $table . '"'; 43 return '"' . $table . '"';