“无法在验证器上设置启用注释,因为注释支持被禁用";在 symfony [英] "enable_annotations on the validator cannot be set as Annotations support is disabled" in symfony

查看:27
本文介绍了“无法在验证器上设置启用注释,因为注释支持被禁用";在 symfony的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个包(成功),当我准备通过控制台创建一个实体时,这发生了(还有 clear:cache):

I just created a bundle (successfully), and when I am about to create an entity via console this happened(also with clear:cache):

[逻辑异常]
验证器上的enable_annotations"不能设置为注释支持已禁用.

[LogicException]
"enable_annotations" on the validator cannot be set as Annotations support is disabled.

mi config.yml 看起来像

mi config.yml looks like

framework:
    validation: { enable_annotations: true }
    serializer: { enable_annotations: true }

当我评论验证选项时会抛出相同的异常,但使用序列化程序

when i comment the options for validation throws the same Exception but with the serializer

当我对两者都发表评论时,它就变成了 ServiceNotFoundException

when i comment both then it becomes a ServiceNotFoundException

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]服务routing.loader"依赖于一个不存在的服务一个 notation_reader".

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service "routing.loader" has a dependency on a non-existent service "an notation_reader".

有什么问题,我使用的是 symfony 3.3.11

What is the problem, I am using symfony 3.3.11

推荐答案

一般来说,您还需要启用注释支持.一旦 Doctrine\Common\Annotations\Annotation 类出现,这就会自动发生.为此,您需要确保安装 doctrine/annotations 包.

You also need to enable annotation support in general. This happens automatically as soon as the Doctrine\Common\Annotations\Annotation class is present. For this, you need to make sure to install the doctrine/annotations package.

这篇关于“无法在验证器上设置启用注释,因为注释支持被禁用";在 symfony的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆