1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-26 18:21:02 +00:00

Move source files directly under src/ directory

This commit is contained in:
Yassine Guedidi 2024-02-19 00:39:48 +01:00
parent 804261bc26
commit a37b385c23
190 changed files with 19 additions and 21 deletions

View file

@ -0,0 +1,37 @@
<?php
namespace Wallabag\CoreBundle\Doctrine;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\JsonType;
/**
* Removed type from DBAL in v3.
* The type is no more used, but we must keep it in order to avoid error during migrations.
*
* @see https://github.com/doctrine/dbal/commit/6ed32a9a941acf0cb6ad384b84deb8df68ca83f8
* @see https://dunglas.dev/2022/01/json-columns-and-doctrine-dbal-3-upgrade/
*/
class JsonArrayType extends JsonType
{
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value || '' === $value) {
return [];
}
$value = \is_resource($value) ? stream_get_contents($value) : $value;
return json_decode($value, true);
}
public function getName()
{
return 'json_array';
}
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;
}
}

View file

@ -0,0 +1,60 @@
<?php
namespace Wallabag\CoreBundle\Doctrine;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
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
{
public 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): void
{
}
public function down(Schema $schema): void
{
}
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 ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
return '"' . $table . '"';
}
// return escaped table
return '`' . $table . '`';
}
}