mirror of
https://github.com/wallabag/wallabag.git
synced 2024-09-27 14:00:15 +00:00
3c507d676f
Add `isTransactional` to `WallabagMigration` because PHP 8 behave differently with PDO transaction. This is a workaround because we can't upgrade Doctrine Migration for now (upper versions have the fix). - Build is now using Composer v2 (instead of v1) - All actions have been updated to latest version - Fix bug in PHP 8 were `$entry->getTags()` can't be properly used as a _traversable_ by `assertContains` during tests. Added a custom method `Entry::getTagsLabel()` which return a flatted tag array with only label - Replace `assertNotRegExp` by `assertDoesNotMatchRegularExpression` because it was deprecated
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\CoreBundle\Doctrine;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
|
abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
|
|
{
|
|
const UN_ESCAPED_TABLE = true;
|
|
|
|
/**
|
|
* @var ContainerInterface
|
|
*/
|
|
protected $container;
|
|
|
|
// because there are declared as abstract in `AbstractMigration` we need to delarer here too
|
|
public function up(Schema $schema)
|
|
{
|
|
}
|
|
|
|
public function down(Schema $schema)
|
|
{
|
|
}
|
|
|
|
public function setContainer(ContainerInterface $container = null)
|
|
{
|
|
$this->container = $container;
|
|
}
|
|
|
|
/**
|
|
* @todo remove when upgrading DoctrineMigration (only needed for PHP 8)
|
|
*
|
|
* @see https://github.com/doctrine/DoctrineMigrationsBundle/issues/393
|
|
*/
|
|
public function isTransactional(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
protected function getTable($tableName, $unEscaped = false)
|
|
{
|
|
$table = $this->container->getParameter('database_table_prefix') . $tableName;
|
|
|
|
if (self::UN_ESCAPED_TABLE === $unEscaped) {
|
|
return $table;
|
|
}
|
|
|
|
// escape table name is handled using " on postgresql
|
|
if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
|
|
return '"' . $table . '"';
|
|
}
|
|
|
|
// return escaped table
|
|
return '`' . $table . '`';
|
|
}
|
|
}
|