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 }