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