Symfony 4.1 Projectで動作するFOSRestBundleでのビューの返却に問題があります。FOSRestBundleがSymfony 4.1で動作しない
これは私のコントローラからのコードです:
class NewsController extends FOSRestController
{
public function getNewsAction()
{
$data = ['news1', 'news2'];
$view = $this->view($data, 200);
return $this->handleView($view);
}
}
fos_rest:
param_fetcher_listener: true
allowed_methods_listener: true
routing_loader: true
view:
view_response_listener: 'force'
format_listener:
rules:
- { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
fos_rest.yaml framework.yaml
framework:
secret: '%env(APP_SECRET)%'
php_errors:
log: true
sensio_framework_extra:
view: { annotations: true }
だから私はかなり基本的な構成を持っている、と私はまだ取得していますこのようなエラー:
(1/1) RuntimeException You must enable the SensioFrameworkExtraBundle view annotations to use the ViewResponseListener.
は私が ":view_response_listener:ビューの力"を" 削除しようとしたが、その後私は、このエラーが生じています:
An instance of Symfony\Bundle\FrameworkBundle\Templating\EngineInterface >must be injected in FOS\RestBundle\View\ViewHandler to render templates.
I'amは時間のためにそれで苦労します。 Symfony 4ベータ版のためですか?あるいは、私は何か間違っているのでしょうか?たぶん私はいくつかの依存を逃すだろうか?私は公式の文書でこの問題に役立つ何かを見つけることができませんでした。
[this](https://github.com/symfony/symfony/issues/25103)に関連する可能性があります。ちなみに、4.1はマスター開発版です。 4.0はリリース候補段階にあります。 – Cerad
そして[バンドル互換性スプレッドシート](https://docs.google.com/spreadsheets/d/1mFHQPp9uKtQTFjOBShIoPNHYgmkjHHdskdrd2C0BaF8/edit#gid=1730100865)によると、fosrestbundleはまだ4.xをサポートしていません。驚くべきことではありません。 – Cerad