问题描述
在自定义命令中使用默认 Sylius CompositeChannelContext
会出现错误,该频道未找到。
[Sylius\Component\Channel\Context\ChannelNotFoundException]
Channel Could not be found! Tip: You can use the Web Debug Toolbar to switch between channels in development.
在 Profiler 中更改它没有什么不同。
我应该如何在 Command 中使用 ChannelContext?
解决方法
以低优先级创建 CustomChannelContext 使我能够绕过此错误。现在,每当 CompositeChannelContext 被调用时,它最后都会通过我的 CustomChannelContext 并获取存储库中的最后一个通道。