Move lastRelease jsonFile to attribute

This commit is contained in:
Tim
2025-04-28 00:43:43 +02:00
parent 38a53c6bd3
commit aa05a1c98e
2 changed files with 3 additions and 6 deletions

View File

@ -19,7 +19,3 @@ services:
- '../src/DependencyInjection/' - '../src/DependencyInjection/'
- '../src/Entity/' - '../src/Entity/'
- '../src/Kernel.php' - '../src/Kernel.php'
App\Service\LastRelease:
arguments:
- '%kernel.project_dir%/release.json'

View File

@ -3,6 +3,7 @@
namespace App\Service; namespace App\Service;
use JetBrains\PhpStorm\ArrayShape; use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
class LastRelease class LastRelease
{ {
@ -18,7 +19,7 @@ class LastRelease
])] ])]
private array $lastRelease = []; private array $lastRelease = [];
public function __construct(string $jsonFile) public function __construct(#[Autowire('%kernel.project_dir%/release.json')] string $jsonFile)
{ {
if (file_exists($jsonFile)) { if (file_exists($jsonFile)) {
$this->lastRelease = json_decode(file_get_contents($jsonFile), true); $this->lastRelease = json_decode(file_get_contents($jsonFile), true);