TheBigBrainsCompany / TbbcMoneyBundle

This bundle is used to integrate the Money library (https://github.com/mathiasverraes/money) into a Symfony project. This library is based on Fowler's Money pattern (https://verraes.net/2011/04/fowler-money-pattern-in-php/)
MIT License
192 stars 74 forks source link

Missing argument for tbbc_money.ratio_provider.ecb #141

Closed LauLaman closed 2 years ago

LauLaman commented 2 years ago

The V5.0.0 is missing a argument in the service definition (also mentioned here by @baldurrensch)

Error:

In ECBRatioProvider.php line 38:
Tbbc\MoneyBundle\Pair\RatioProvider\ECBRatioProvider::__construct(): Argument #1 ($client) must be of type Symfony\Contracts\HttpClient\HttpClientInterface, Symfony\Component\HttpClient\HttplugClient given, called in /application/var/cache/de_/ContainerXs6RVmb/App_KernelDevDebugContainer.php on line 1324

This is because the service definition does not specify the constructor argument:

<!-- src/Resources/config/services.xml -->
<service id="tbbc_money.ratio_provider.ecb" class="%tbbc_money.ratio_provider.ecb.class%">
</service>

Should be:

<!-- src/Resources/config/services.xml -->
<service id="tbbc_money.ratio_provider.ecb" class="%tbbc_money.ratio_provider.ecb.class%">
     <argument type="service" id="Symfony\Contracts\HttpClient\HttpClientInterface"/>
</service>

Fix for now:

Add this to your services.yaml to overwrite the service definition:

# config/services.yaml

services:
    # ...

    tbbc_money.ratio_provider.ecb:
        class: Tbbc\MoneyBundle\Pair\RatioProvider\ECBRatioProvider
        arguments:
            - '@Symfony\Contracts\HttpClient\HttpClientInterface'
wouter-toppy commented 2 years ago

@johanwilfer @lsv @hanishsingla

created a pull #142 . Any change you can check?

johanwilfer commented 2 years ago

Thanks for the PR, I have merged this into master now. Can you verify that it works using "dev-master" @wouter-toppy ?

We can tag a new release later then.

wouter-toppy commented 2 years ago

@johanwilfer Its working, you can tag the new version ;-)

johanwilfer commented 2 years ago

Done @wouter-toppy , thanks for checking! :)