[英]error between FosRestBundle and SensioFramewordBundle
我安裝了兩個庫FOSRest和Sensio,但是出現以下錯誤:
You must enable the SensioFrameworkExtraBundle view annotations to use the ViewResponseListener. Did you forget to install and enable the TwigBundle?
雖然我不需要Twig,因為我的API會將所有內容發送回json。
我仍然嘗試安裝它,但是仍然有問題。
這是Sensio的配置:
sensio_framework_extra:
router:
annotations: false
view:
annotations: true
request:
converters: true
對於FOSREST:
fos_rest:
body_converter:
enabled: true
serializer:
serialize_null: true
view:
formats: { json: true, xml: false, rss: false }
view_response_listener: true
format_listener:
rules:
- { path: '^/', priorities: ['json'], fallback_format: 'json' }
沒什么很重要的。
我希望你能幫助我。
感謝您
盡管這不是最令人滿意的解決方案,但正如消息提示的那樣,我在一個令人沮喪的小時后最終安裝了TwigBundle。
composer require symfony/twig-bundle
這應該可以解決您的錯誤。
我說這不是最令人滿意的解決方案,因為就像您一樣,我根本不需要Twig模板,因此安裝它並不自然。 我花了很多時間弄清楚為什么FOSRest需要這個。 它是否依賴於某些Twig代碼塊來運行? 我不知道,這只是我發現的最好,最快的解決方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.