ShopApiPlugin icon indicating copy to clipboard operation
ShopApiPlugin copied to clipboard

Multiple "getChannel"s ignore "enabled" property of Channel

Open diimpp opened this issue 6 years ago • 2 comments
trafficstars

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

diimpp avatar Oct 04 '19 17:10 diimpp

Shouldn't those getChannel calls be completely be replaced by the ChannelContext?

mamazu avatar Jan 22 '20 12:01 mamazu

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.

diimpp avatar Jul 20 '20 11:07 diimpp