sylius - Sylius:自定义命令中未找到频道
问题描述
在自定义命令中使用默认 SyliusCompositeChannelContext
会出错,找不到该频道。
[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 并获取存储库中的最后一个通道。
推荐阅读
- pandas - 熊猫重写函数而不调用apply
- java - 反序列化抽象父类型的构造函数参数时获取 UnresolvedForwardReference
- javascript - Vue:冲突的顺序。添加了以下模块
- python - 带 args 参数的 Python 求和
- sql - 保留 SQLite 中表达式之前的子字符串
- linux - 每秒将“perf stat”输出保存到文件中
- python - sklearn Logistic回归中的C参数是什么?
- django - ElasticSearch、FarmHaystack、Django 连接被拒绝
- python-3.x - 我什么时候使用python装饰器函数@cache
- django - 如何准确过滤列表 JSONField?