Skip to content

Commit

Permalink
feat: remove symfony/templating (#154)
Browse files Browse the repository at this point in the history
* feat: remove symfony/templating

* feat: remove symfony/templating

* feat: remove symfony/templating

* Merge change log 5 & 6 as they were the same, and 7 -> 6 (it is 6.x we will release)

* Remove configuration

* twig is not depending on config

* Add back to changelog

---------

Co-authored-by: Christopher Georg <christopher.georg@sr-travel.de>
Co-authored-by: Johan Wilfer <johan@jttech.se>
  • Loading branch information
3 people authored Feb 24, 2024
1 parent 69ec5c8 commit f173f0f
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 345 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,6 @@ class IndexController extends Controller
{{ $amount | money_format_currency }}
```

### PHP templating integration

```php
<span class="price"><?php echo $view['tbbc_money']->format($price) ?></span>
<span class="money"><?php echo $view['tbbc_money_currency']->formatCurrencyAsSymbol($price->getCurrency()) ?></span>
```

### Fetching ratio values from remote provider

```bash
Expand Down Expand Up @@ -613,7 +606,6 @@ Optimizations

In your config.yml, you can :

* select the templating engine to use. By default, only Twig is loaded.
* define the decimals count after a unit (ex : 12.25€ : 2 decimals ; 11.5678€ : 4 decimals)

```yaml
Expand Down
51 changes: 0 additions & 51 deletions Tests/Templating/Helper/CurrencyHelperTest.php

This file was deleted.

101 changes: 0 additions & 101 deletions Tests/Templating/Helper/MoneyHelperTest.php

This file was deleted.

7 changes: 7 additions & 0 deletions change-log-5.0-and-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Versions from 5.0
- Dropped support for yahoo finance provider (they don't offer this anymore)
- Dropped support for Google provider (doesn't exist anymore)

- Drop `YahooFinanceRatioProvider` ratio provider support
- Remove `tbbc_money.ratio_provider.yahoo_finance.class` container parameter
- Remove `tbbc_money.ratio_provider.yahoo_finance` service definition
- Drop `GoogleRatioProvider` ratio provider support
- Remove `tbbc_money.ratio_provider.google.class` container parameter
- Remove `tbbc_money.ratio_provider.google` service definition

**Internal Developer things**
- Added psalm level 1 (highest level)
- Added php cs fixer
Expand Down
10 changes: 2 additions & 8 deletions change-log-6.0-and-versions.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
Versions from 6.0
-----------------

### 2023-10-31 : updates for 6.0.0 version
### TBD : updates for 6.0.0 version

**New features**

**BC breaking changes**

- Drop `YahooFinanceRatioProvider` ratio provider support
- Remove `tbbc_money.ratio_provider.yahoo_finance.class` container parameter
- Remove `tbbc_money.ratio_provider.yahoo_finance` service definition
- Drop `GoogleRatioProvider` ratio provider support
- Remove `tbbc_money.ratio_provider.google.class` container parameter
- Remove `tbbc_money.ratio_provider.google` service definition
- Drop `symfony/templating` and template function (use twig)

**Internal Developer things**
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/templating": "^5.4|^6.0|^7.0",
"symfony/http-client": "^5.4|^6.0|^7.0"
},
"autoload": {
Expand Down
21 changes: 0 additions & 21 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,6 @@ private function addCurrencySection(ArrayNodeDefinition $node): void
->cannotBeEmpty()
->defaultValue('tbbc_money.ratio_provider.ecb')
->end()
->arrayNode('templating')
->addDefaultsIfNotSet()
->children()
->arrayNode('engines')
->isRequired()
->requiresAtLeastOneElement()
->example(['twig'])
->beforeNormalization()
->ifTrue(fn ($v) => !is_array($v))
->then(fn ($v) => [$v])
->end()
->prototype('scalar')
->validate()
->ifNotInArray(['twig', 'php'])
->thenInvalid('Only "twig" and "php" engines are supported.')
->end()
->end()
->defaultValue(['twig'])
->end()
->end()
->end()
->end()
;
}
Expand Down
9 changes: 1 addition & 8 deletions src/DependencyInjection/TbbcMoneyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ public function load(array $configs, ContainerBuilder $container): void
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$loader->load('form_types.xml');

if (in_array('twig', $config['templating']['engines'], true)) {
$loader->load('twig_extension.xml');
}

if (in_array('php', $config['templating']['engines'], true)) {
$loader->load('templating_helper.xml');
}
$loader->load('twig_extension.xml');

$this->remapParameters($config, $container, [
'currencies' => 'tbbc_money.currencies',
Expand Down
24 changes: 0 additions & 24 deletions src/Resources/config/templating_helpers.xml

This file was deleted.

43 changes: 0 additions & 43 deletions src/Templating/Helper/CurrencyHelper.php

This file was deleted.

Loading

0 comments on commit f173f0f

Please sign in to comment.