ShopApiPlugin
ShopApiPlugin copied to clipboard
Multiple "getChannel"s ignore "enabled" property of Channel
I've encountered two cases, but codebase needs to be grepped for more.
https://github.com/Sylius/ShopApiPlugin/blob/master/src/ViewRepository/Product/ProductCatalogViewRepository.php#L88 https://github.com/Sylius/ShopApiPlugin/blob/master/src/ViewRepository/Product/ProductLatestViewRepository.php#L61
Shouldn't those getChannel calls be completely be replaced by the ChannelContext?
Using ChannelContext inside ViewRepository makes it stateful, which should be avoided. (ViewRepository is a sort of QueryHandler in Command/CommandHandler and CQS terms)
We can add ChannelProvider or just ChannelRepository method, which will select only enabled channels.