From e89290473b67e2c2af7d29e25d10dc74e01cd3ee Mon Sep 17 00:00:00 2001 From: Ondrej Vlach Date: Tue, 16 Jan 2024 20:29:04 +0100 Subject: [PATCH] feat: add currency lister feat: add currency lister static currency lister --- config/services.yaml | 7 +++++++ src/Service/CurrencyListerInterface.php | 12 ++++++++++++ src/Service/StaticCurrencyLister.php | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/Service/CurrencyListerInterface.php create mode 100644 src/Service/StaticCurrencyLister.php diff --git a/config/services.yaml b/config/services.yaml index cef039c..e32c865 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,6 +4,8 @@ # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: + env(SYMFONY_EXAMPLE_APP_CURRENCIES): '["CZK", "EUR", "USD", "GBP"]' + app.currencies: '%env(json:SYMFONY_EXAMPLE_APP_CURRENCIES)%' services: # default configuration for services in *this* file @@ -21,5 +23,10 @@ services: - '../src/Entity/' - '../src/Kernel.php' + App\Service\StaticCurrencyLister: + arguments: + $available_currencies: '%app.currencies%' + + App\Service\CurrencyListerInterface: '@App\Service\StaticCurrencyLister' # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones diff --git a/src/Service/CurrencyListerInterface.php b/src/Service/CurrencyListerInterface.php new file mode 100644 index 0000000..0213311 --- /dev/null +++ b/src/Service/CurrencyListerInterface.php @@ -0,0 +1,12 @@ +available_currencies; + } +}