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

[Documentation] Concepts: Currencies #5527

Merged
merged 1 commit into from Jul 27, 2016

Conversation

CoderMaggie
Copy link
Member

@CoderMaggie CoderMaggie commented Jul 18, 2016

Q A
Doc fix? yes
New docs? yes
BC breaks? no
Related tickets partially #5275
License MIT

@pamil
Copy link
Contributor

pamil commented Jul 18, 2016

Will be quite outdated after #5497 🎉

@CoderMaggie
Copy link
Member Author

@pamil not everything, but yes. Some parts are waiting for its merge :)

@pjedrzejewski
Copy link
Member

@TheMadeleine I think we are missing example of switching the currency, hm?

@pamil
Copy link
Contributor

pamil commented Jul 26, 2016

There's sylius.storage.currency service implementing Sylius\Component\Core\Currency\CurrencyStorageInterface with methods set(ChannelInterface $channel, $currencyCode) and get(ChannelInterface $channel).

So $container->get('sylius.storage.currency')->set($channel, 'PLN') may be an example.

@pjedrzejewski
Copy link
Member

@pamil What do you think about switching the currency on the context itself? That would be of course separate interface and implementation. Because using storage for that sounds weird. Storage should probably be a private service.

@pamil
Copy link
Contributor

pamil commented Jul 26, 2016

This would require additional type checks before any call to that context. Moreover, creating decorators for contexts would be nearly impossible.

Let's say we've got SettableCurrencyContextInterface, so decorator for it should also implement the same. But since we can also decorate a regular context, we need to perform a type check inside set() in the decorator, which results that we can't rely on that interface fully.

I don't like those storage mess too much, but it seems much simplier for now.


Available Currencies Provider
-----------------------------

The default menu for selecting currency is using a special service called ``sylius.currency_provider``, which returns all enabled currencies.
The default menu for selecting currency is using a service - **CurrencyProvider** - with the ``sylius.currency_provider`` id, which returns all enabled currencies.
This is your entry point if you would like override this logic and return different currencies for various scenarios.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to override?

@pjedrzejewski pjedrzejewski added the Documentation Documentation related issues and PRs - requests, fixes, proposals. label Jul 27, 2016
@pjedrzejewski pjedrzejewski merged commit e116e78 into Sylius:master Jul 27, 2016
@pjedrzejewski
Copy link
Member

Thanks Magda and Kamil!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation related issues and PRs - requests, fixes, proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants