Compare commits

...

3 commits

Author SHA1 Message Date
Jan Böhmer
5c4aa11b4b Fixed problems with container injection into migrations
Some checks are pending
Build assets artifact / Build assets artifact (push) Waiting to run
Docker Image Build / docker (push) Waiting to run
Docker Image Build (FrankenPHP) / docker (push) Waiting to run
Static analysis / Static analysis (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Waiting to run
2025-07-12 23:39:26 +02:00
Jan Böhmer
1b86257836 Replaced the obsolete containerawareinterface with own implementation 2025-07-12 23:10:59 +02:00
Jan Böhmer
0f5fb992ef Updated dependencies 2025-07-12 22:56:12 +02:00
6 changed files with 121 additions and 36 deletions

58
composer.lock generated
View file

@ -1740,21 +1740,21 @@
},
{
"name": "doctrine/dbal",
"version": "4.2.4",
"version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "b37d160498ea91a2382a2ebe825c4ea6254fc0ec"
"reference": "5fe09532be619202d59c70956c6fb20e97933ee3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/b37d160498ea91a2382a2ebe825c4ea6254fc0ec",
"reference": "b37d160498ea91a2382a2ebe825c4ea6254fc0ec",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/5fe09532be619202d59c70956c6fb20e97933ee3",
"reference": "5fe09532be619202d59c70956c6fb20e97933ee3",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^0.5.3|^1",
"php": "^8.1",
"doctrine/deprecations": "^1.1.5",
"php": "^8.2",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
},
@ -1765,7 +1765,7 @@
"phpstan/phpstan": "2.1.17",
"phpstan/phpstan-phpunit": "2.0.6",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "10.5.46",
"phpunit/phpunit": "11.5.23",
"slevomat/coding-standard": "8.16.2",
"squizlabs/php_codesniffer": "3.13.1",
"symfony/cache": "^6.3.8|^7.0",
@ -1826,7 +1826,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/4.2.4"
"source": "https://github.com/doctrine/dbal/tree/4.3.0"
},
"funding": [
{
@ -1842,7 +1842,7 @@
"type": "tidelift"
}
],
"time": "2025-06-15T23:15:01+00:00"
"time": "2025-06-16T19:31:04+00:00"
},
{
"name": "doctrine/deprecations",
@ -7589,16 +7589,16 @@
},
{
"name": "sabberworm/php-css-parser",
"version": "v8.8.0",
"version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "3de493bdddfd1f051249af725c7e0d2c38fed740"
"reference": "d8e916507b88e389e26d4ab03c904a082aa66bb9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/3de493bdddfd1f051249af725c7e0d2c38fed740",
"reference": "3de493bdddfd1f051249af725c7e0d2c38fed740",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d8e916507b88e389e26d4ab03c904a082aa66bb9",
"reference": "d8e916507b88e389e26d4ab03c904a082aa66bb9",
"shasum": ""
},
"require": {
@ -7606,7 +7606,8 @@
"php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41"
"phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41",
"rawr/cross-data-providers": "^2.0.0"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
@ -7648,9 +7649,9 @@
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.8.0"
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.9.0"
},
"time": "2025-03-23T17:59:05+00:00"
"time": "2025-07-11T13:20:48+00:00"
},
{
"name": "scheb/2fa-backup-code",
@ -16791,16 +16792,16 @@
},
{
"name": "rector/rector",
"version": "2.1.0",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "d513dea45a94394b660e15c155d1fa27826f8e30"
"reference": "d0917c069bb0d9bb06ed111cf052510f609015a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/d513dea45a94394b660e15c155d1fa27826f8e30",
"reference": "d513dea45a94394b660e15c155d1fa27826f8e30",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/d0917c069bb0d9bb06ed111cf052510f609015a4",
"reference": "d0917c069bb0d9bb06ed111cf052510f609015a4",
"shasum": ""
},
"require": {
@ -16839,7 +16840,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.1.0"
"source": "https://github.com/rectorphp/rector/tree/2.1.1"
},
"funding": [
{
@ -16847,7 +16848,7 @@
"type": "github"
}
],
"time": "2025-06-24T20:26:57+00:00"
"time": "2025-07-10T11:31:31+00:00"
},
{
"name": "roave/security-advisories",
@ -16855,12 +16856,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "a76f62e135c8b583602bd99df737b5c20f4d7200"
"reference": "56a0a5fbffe6faa8e85eb4d027a3eaf704adc288"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/a76f62e135c8b583602bd99df737b5c20f4d7200",
"reference": "a76f62e135c8b583602bd99df737b5c20f4d7200",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/56a0a5fbffe6faa8e85eb4d027a3eaf704adc288",
"reference": "56a0a5fbffe6faa8e85eb4d027a3eaf704adc288",
"shasum": ""
},
"conflict": {
@ -17198,7 +17199,7 @@
"jackalope/jackalope-doctrine-dbal": "<1.7.4",
"jambagecom/div2007": "<0.10.2",
"james-heinrich/getid3": "<1.9.21",
"james-heinrich/phpthumb": "<1.7.12",
"james-heinrich/phpthumb": "<=1.7.23",
"jasig/phpcas": "<1.3.3",
"jbartels/wec-map": "<3.0.3",
"jcbrand/converse.js": "<3.3.3",
@ -17300,7 +17301,7 @@
"microsoft/microsoft-graph": ">=1.16,<1.109.1|>=2,<2.0.1",
"microsoft/microsoft-graph-beta": "<2.0.1",
"microsoft/microsoft-graph-core": "<2.0.2",
"microweber/microweber": "<=2.0.16",
"microweber/microweber": "<=2.0.19",
"mikehaertl/php-shellcommand": "<1.6.1",
"miniorange/miniorange-saml": "<1.4.3",
"mittwald/typo3_forum": "<1.2.1",
@ -17661,6 +17662,7 @@
"ua-parser/uap-php": "<3.8",
"uasoft-indonesia/badaso": "<=2.9.7",
"unisharp/laravel-filemanager": "<2.9.1",
"universal-omega/dynamic-page-list3": "<3.6.4",
"unopim/unopim": "<0.1.5",
"userfrosting/userfrosting": ">=0.3.1,<4.6.3",
"usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2",
@ -17802,7 +17804,7 @@
"type": "tidelift"
}
],
"time": "2025-07-04T13:13:44+00:00"
"time": "2025-07-11T23:05:27+00:00"
},
{
"name": "sebastian/cli-parser",

View file

@ -4,18 +4,15 @@ declare(strict_types=1);
namespace DoctrineMigrations;
use App\Doctrine\Migration\ContainerAwareMigrationInterface;
use App\Migration\AbstractMultiPlatformMigration;
use App\Migration\WithPermPresetsTrait;
use App\Services\UserSystem\PermissionPresetsHelper;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221114193325 extends AbstractMultiPlatformMigration implements ContainerAwareInterface
final class Version20221114193325 extends AbstractMultiPlatformMigration implements ContainerAwareMigrationInterface
{
use WithPermPresetsTrait;

View file

@ -4,16 +4,16 @@ declare(strict_types=1);
namespace DoctrineMigrations;
use App\Doctrine\Migration\ContainerAwareMigrationInterface;
use App\Migration\AbstractMultiPlatformMigration;
use App\Migration\WithPermPresetsTrait;
use App\Services\UserSystem\PermissionPresetsHelper;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240606203053 extends AbstractMultiPlatformMigration implements ContainerAwareInterface
final class Version20240606203053 extends AbstractMultiPlatformMigration implements ContainerAwareMigrationInterface
{
use WithPermPresetsTrait;

View file

@ -0,0 +1,55 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Doctrine\Migration;
use App\Services\UserSystem\PermissionPresetsHelper;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\Migrations\Version\MigrationFactory;
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Psr\Container\ContainerInterface;
#[AsDecorator("doctrine.migrations.migrations_factory")]
class ContainerAwareMigrationFactory implements MigrationFactory
{
public function __construct(private readonly MigrationFactory $decorated,
//List all services that should be available in migrations here
#[AutowireLocator([
PermissionPresetsHelper::class
])]
private readonly ContainerInterface $container)
{
}
public function createVersion(string $migrationClassName): AbstractMigration
{
$migration = $this->decorated->createVersion($migrationClassName);
if ($migration instanceof ContainerAwareMigrationInterface) {
$migration->setContainer($this->container);
}
return $migration;
}
}

View file

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Doctrine\Migration;
use Psr\Container\ContainerInterface;
interface ContainerAwareMigrationInterface
{
public function setContainer(?ContainerInterface $container = null): void;
}

View file

@ -26,7 +26,7 @@ namespace App\Migration;
use App\Entity\UserSystem\PermissionData;
use App\Security\Interfaces\HasPermissionsInterface;
use App\Services\UserSystem\PermissionPresetsHelper;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Psr\Container\ContainerInterface;
trait WithPermPresetsTrait
{