Sylius:在自定义命令中找不到频道

Sylius: Channel not found in custom command

在自定义命令中使用默认 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 中更改它没有什么不同。

如何在命令中使用 ChannelContext?

创建低优先级的 CustomChannelContext 让我绕过了这个错误。现在,每当调用 CompositeChannelContext 时,它最后都会通过我的 CustomChannelContext 并获取存储库中的最后一个通道。