0
我在Symfony 3.3中使用FOSElasticaBundle。我已經註冊上計算POST_TRANSFORM事件和adds a custom property事件偵聽器是這樣的:FOSElasticaBundle:自定義屬性的設置分析器
public function addCustomProperty(TransformEvent $event)
{
$document = $event->getDocument();
$custom = $this->anotherService->calculateCustom($event->getObject());
$document->set('custom', $custom);
}
現在我需要設置使用此屬性的分析。我怎樣才能做到這一點?
我已經嘗試將自定義字段名稱添加到我的fos_elastica配置中的類型定義,但是導致一個異常,因爲該包然後也期望我的實體上的屬性。