Private
Public Access
1
0

chg: pkg: make a massive refactor to the backend and remove all unnecessary deps - and make small refactors for the frontend too #4

This commit is contained in:
2026-04-09 20:21:01 +02:00
parent 23547f4237
commit b55c223d8a
55 changed files with 1567 additions and 4398 deletions

View File

@@ -0,0 +1,63 @@
<?php declare(strict_types=1);
/**
* This file is part of the SplendidBear Websites' projects.
*
* Copyright (c) 2024 @ www.splendidbear.org
*
* For the full copyright and licence information, please view the LICENCE
* file that was distributed with this source code.
*/
namespace App\Doctrine;
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
use Doctrine\ORM\Tools\ToolEvents;
use RuntimeException;
/**
* Class FixPostgreMigrationDefaultSchemaListener
*
* @package App\Doctrine
* @author Lang <https://www.splendidbear.org>
* @category Class
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
* @link www.splendidbear.org
* @since 2023. 02. 28.
*
* @see https://github.com/doctrine/dbal/issues/1110
* There is a recent bug when you create new migration, it creates a new schema even if there is no any
* changes.
*/
#[AsDoctrineListener(event: ToolEvents::postGenerateSchema, priority: 500, connection: 'default')]
final class FixPostgreMigrationDefaultSchemaListener
{
public function postGenerateSchema(GenerateSchemaEventArgs $args): void
{
try {
$schemaManager = $args
->getEntityManager()
->getConnection()
->createSchemaManager();
if (!$schemaManager instanceof PostgreSqlSchemaManager) {
return;
}
$schema = $args->getSchema();
foreach ($schemaManager->getExistingSchemaSearchPaths() as $namespace) {
if ($schema->hasNamespace($namespace)) {
continue;
}
$schema->createNamespace($namespace);
}
} catch (SchemaException|Exception $e) {
throw new RuntimeException($e->getMessage());
}
}
}