【发布时间】:2016-06-29 05:53:15
【问题描述】:
您能帮忙解决以下错误吗?
InvalidArgumentException: "fos_rest.serializer" must implement FOS\RestBundle\Serializer\Serializer (instance of "JMS\Serializer\Serializer" given).
in C:\wamp\www\SymfonyRestAPI\src\FOS\RestBundle\DependencyInjection\Compiler\SerializerConfigurationPass.php line 58
at SerializerConfigurationPass->process(object(ContainerBuilder)) in C:\wamp\www\SymfonyRestAPI\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\Compiler.php line 117
at Compiler->compile(object(ContainerBuilder)) in C:\wamp\www\SymfonyRestAPI\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php line 613
at ContainerBuilder->compile() in C:\wamp\www\SymfonyRestAPI\app\bootstrap.php.cache line 2502
at Kernel->initializeContainer() in C:\wamp\www\SymfonyRestAPI\app\bootstrap.php.cache line 2281
at Kernel->boot() in C:\wamp\www\SymfonyRestAPI\app\bootstrap.php.cache line 2312
at Kernel->handle(object(Request)) in C:\wamp\www\SymfonyRestAPI\web\app_dev.php line 28
【问题讨论】:
-
这太宽泛了。但我认为您必须添加配置文件的代码。哪个类与“fos_rest.serializer”相关
-
我遵循了 symfony 教程的所有步骤,但总是出现同样的错误,在 appKernel.php 文件中我添加了新的 FOS\RestBundle\FOSRestBundle()、新的 JMS\SerializerBundle\JMSSerializerBundle()
-
在 composer.json 我添加了 "friendsofsymfony/rest-bundle": "0.11.*", "jms/serializer-bundle": "0.12.x-dev" 但同样的错误再次
-
请在答案中添加您的 cmets 的内容。您应该提供minimal reproducible example。
-
@GitaarLAB 你是对的,谢谢你的评论。
标签: php symfony fosrestbundle jmsserializerbundle