Skip to content

Commit

Permalink
Consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed May 23, 2024
1 parent 7723c4a commit 75fedfd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions config/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
class: Pimcore\Bundle\StudioBackendBundle\Setting\Service\SettingsService

Pimcore\Bundle\StudioBackendBundle\Setting\Provider\ConfigSettingsProvider:
tags: [ 'pimcore.studio_api.settings_provider' ]
tags: [ 'pimcore.studio_backend.settings_provider' ]

Pimcore\Bundle\StudioBackendBundle\Setting\Provider\SystemSettingsProvider:
tags: [ 'pimcore.studio_api.settings_provider' ]
tags: [ 'pimcore.studio_backend.settings_provider' ]
5 changes: 1 addition & 4 deletions src/Setting/Controller/GetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@

use OpenApi\Attributes\Get;
use OpenApi\Attributes\JsonContent;
use Pimcore\Bundle\AdminBundle\System\AdminConfig;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\MethodNotAllowedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnprocessableContentResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnsupportedMediaTypeResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Setting\Service\SettingsServiceInterface;
use Pimcore\Config;
use Pimcore\SystemSettingsConfig;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\SerializerInterface;
Expand Down Expand Up @@ -66,4 +63,4 @@ public function getSystemSettings(): JsonResponse
{
return $this->jsonResponse($this->settingsService->getSettings());
}
}
}
8 changes: 5 additions & 3 deletions src/Setting/Provider/ConfigSettingsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
namespace Pimcore\Bundle\StudioBackendBundle\Setting\Provider;

use Pimcore\Config;
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;

/**
* @internal
*/
final class ConfigSettingsProvider implements SettingsProviderInterface
#[AsTaggedItem('pimcore.studio_backend.settings_provider')]
final readonly class ConfigSettingsProvider implements SettingsProviderInterface
{
public function __construct(
private readonly Config $config
private Config $config
)
{

Expand All @@ -40,4 +42,4 @@ public function getSettings(): array
];

}
}
}
8 changes: 5 additions & 3 deletions src/Setting/Provider/SystemSettingsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
namespace Pimcore\Bundle\StudioBackendBundle\Setting\Provider;

use Pimcore\SystemSettingsConfig;
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;

/**
* @internal
*/
final class SystemSettingsProvider implements SettingsProviderInterface
#[AsTaggedItem('pimcore.studio_backend.settings_provider')]
final readonly class SystemSettingsProvider implements SettingsProviderInterface
{
private readonly array $systemSettings;
private array $systemSettings;

public function __construct(
SystemSettingsConfig $systemSettingsConfig,
Expand All @@ -45,4 +47,4 @@ public function getSettings(): array
'main_domain' => $this->systemSettings['general']['domain'],
];
}
}
}
2 changes: 1 addition & 1 deletion src/Setting/Service/Loader/TaggedIteratorAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
final class TaggedIteratorAdapter implements SettingProviderLoaderInterface
{
public const SETTINGS_PROVIDER_TAG = 'pimcore.studio_api.settings_provider';
public const SETTINGS_PROVIDER_TAG = 'pimcore.studio_backend.settings_provider';

public function __construct(
#[TaggedIterator(self::SETTINGS_PROVIDER_TAG)]
Expand Down
8 changes: 4 additions & 4 deletions src/Setting/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
/**
* @internal
*/
final class SettingsService implements SettingsServiceInterface
final readonly class SettingsService implements SettingsServiceInterface
{
public function __construct(
private readonly SettingProviderLoaderInterface $settingProviderLoader
private SettingProviderLoaderInterface $settingProviderLoader
)
{
}

public function getSettings(): array
{
$settings = [];
foreach($this->settingProviderLoader->loadSettingProviders() as $settingProvider) {
foreach ($this->settingProviderLoader->loadSettingProviders() as $settingProvider) {
$settings = [
... $settings,
... $settingProvider->getSettings()
];
}
return $settings;
}
}
}

0 comments on commit 75fedfd

Please sign in to comment.