From 116b9701ba332e7ec37be71af09f530298ce5325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Fri, 7 Aug 2026 16:37:25 +0200 Subject: [PATCH] IBX-12204: Read current SiteAccess via SiteAccessServiceInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestSiteaccessCommand used to type-hint the shared, container-wide Ibexa\Core\MVC\Symfony\SiteAccess singleton directly to print the CLI-resolved siteaccess name. ibexa/core's ConsoleCommandListener no longer mutates that singleton in place (see ibexa/core#798, IBX-12204) — it only calls SiteAccessService::changeSiteAccess() with a freshly-constructed SiteAccess — so this command now needs to read the current SiteAccess via SiteAccessServiceInterface::getCurrent() instead. --- src/bundle/Command/TestSiteaccessCommand.php | 12 ++++++------ src/bundle/Resources/config/services.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bundle/Command/TestSiteaccessCommand.php b/src/bundle/Command/TestSiteaccessCommand.php index f34dbd48..00a25936 100644 --- a/src/bundle/Command/TestSiteaccessCommand.php +++ b/src/bundle/Command/TestSiteaccessCommand.php @@ -8,7 +8,7 @@ namespace Ibexa\Bundle\Behat\Command; -use Ibexa\Core\MVC\Symfony\SiteAccess; +use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -17,12 +17,11 @@ #[AsCommand(name: 'ibexa:behat:test-siteaccess', description: 'Outputs the name of the active siteaccess')] class TestSiteaccessCommand extends Command { - /** @var SiteAccess */ - private $siteaccess; + private SiteAccessServiceInterface $siteAccessService; - public function __construct(SiteAccess $siteaccess) + public function __construct(SiteAccessServiceInterface $siteAccessService) { - $this->siteaccess = $siteaccess; + $this->siteAccessService = $siteAccessService; parent::__construct(); } @@ -31,7 +30,8 @@ protected function execute( InputInterface $input, OutputInterface $output ): int { - $output->writeln($this->siteaccess->name); + $siteAccess = $this->siteAccessService->getCurrent(); + $output->writeln($siteAccess !== null ? $siteAccess->name : ''); return self::SUCCESS; } diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index f6da7fea..3e361509 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -73,7 +73,7 @@ services: Ibexa\Bundle\Behat\Command\TestSiteaccessCommand: arguments: - $siteaccess: '@Ibexa\Core\MVC\Symfony\SiteAccess' + $siteAccessService: '@Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface' tags: - { name: console.command }