Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Money::jsonSerialize() should return currency code instead of Currency instance #547

Closed
alle opened this issue Jan 9, 2019 · 0 comments
Closed

Comments

@alle
Copy link

alle commented Jan 9, 2019

Hi,
Both Money and Currency classes implement the \JsonSerializable. 👍
When the Money::jsonSerialize() is used in a (string) context, \json_encode returns the proper JSON representations, since to Currency::jsonSerialize() is implicitly called.
But if the Money::jsonSerialize() is called alone, it returns an instance of Currency for the currency key, instead of its code.

IMHO opinion, this could be:
'currency' => $this->currency->getCode(),.

zek added a commit to zek/money that referenced this issue Feb 19, 2019
frederikbosch pushed a commit that referenced this issue Mar 6, 2019
* Pure json response from jsonSerialize 

Fixes #547

* jsonSerialize function test

* Update MoneyTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant