]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
fixup! fixup! Fix documentation wording for matches/notmatches tagging rules
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Doctrine / WallabagMigration.php
CommitLineData
bfe7a692
JB
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
11{
49b4c875
JB
12 const UN_ESCAPED_TABLE = true;
13
bfe7a692
JB
14 /**
15 * @var ContainerInterface
16 */
17 protected $container;
18
19 // because there are declared as abstract in `AbstractMigration` we need to delarer here too
20 public function up(Schema $schema)
21 {
22 }
23
24 public function down(Schema $schema)
25 {
26 }
27
28 public function setContainer(ContainerInterface $container = null)
29 {
30 $this->container = $container;
31 }
32
49b4c875 33 protected function getTable($tableName, $unEscaped = false)
bfe7a692
JB
34 {
35 $table = $this->container->getParameter('database_table_prefix') . $tableName;
36
49b4c875
JB
37 if (self::UN_ESCAPED_TABLE === $unEscaped) {
38 return $table;
39 }
40
bfe7a692
JB
41 // escape table name is handled using " on postgresql
42 if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
43 return '"' . $table . '"';
44 }
45
46 // return escaped table
47 return '`' . $table . '`';
48 }
49}