From e5c981810fe81e7643c791e545b7f97a7b96abdb Mon Sep 17 00:00:00 2001 From: barw4 Date: Fri, 5 Feb 2021 17:54:11 +0100 Subject: [PATCH] EZEE-3465: Tweaks to RepositoryConfigurationProvider --- .../ApiLoader/RepositoryConfigurationProvider.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryConfigurationProvider.php b/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryConfigurationProvider.php index 89903d26f5f..77783b3171e 100644 --- a/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryConfigurationProvider.php +++ b/eZ/Bundle/EzPublishCoreBundle/ApiLoader/RepositoryConfigurationProvider.php @@ -40,7 +40,7 @@ public function getRepositoryConfig() // Takes configured repository as the reference, if it exists. // If not, the first configured repository is considered instead. $repositoryAlias = $this->configResolver->getParameter('repository'); - $repositoryAlias = $repositoryAlias ?: $this->pullDefaultRepository(); + $repositoryAlias = $repositoryAlias ?: $this->getDefaultRepositoryAlias(); if (empty($repositoryAlias) || !isset($this->repositories[$repositoryAlias])) { throw new InvalidRepositoryException( @@ -51,7 +51,12 @@ public function getRepositoryConfig() return ['alias' => $repositoryAlias] + $this->repositories[$repositoryAlias]; } - public function pullDefaultRepository(): ?string + public function getCurrentRepositoryAlias(): string + { + return $this->getRepositoryConfig()['alias']; + } + + public function getDefaultRepositoryAlias(): ?string { $aliases = array_keys($this->repositories);