我的体系结构是基于Symfony 4.4 / ApiPLatform / Mercure /角9的。我通过在我的resources.yaml ApiPlatform conf文件中添加mercure:true来简单地推动Mercure的工作。现在我需要进行隐私更新。因此,对于ApiPlatform,我必须添加参数私有:true。但是API的响应现在是:
自从Mercure 0.10之后,
目标就不再存在了。将更新标记为私有,或者将Mercure组件降级为0.3版
这是我的yaml配置:
resources:
App\Entity\Order:
attributes:
mercure:
- private: true
- topics: ['object.getMercureTopics()']正确的配置应该是什么?
发布于 2020-07-04 14:54:40
事实上,不是像我想的那样在每个选项中计算ExpressionLanguage,只有当配置的选项是字符串时才计算它。因此,如果需要主题(或其他内容)的ExpressionLanguage,解决方案如下:
public function getMercureOptions()
{
$topic = sprintf(
'%s/%s',
self::MERCURE_TOPIC_PREFIX,
$this->getSomethingFromTheObject()
);
return [
"private" => true,
"topics" => [$topic]
];
}然后,yaml配置文件应该是:
resources:
App\Entity\Order:
attributes:
mercure: "object.getMercureOptions()"https://stackoverflow.com/questions/62730047
复制相似问题