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

查看:151
本文介绍了“不能在验证器上设置enable_annotations,因为注释支持被禁用".在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):

[LogicException]
验证器上的"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.

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

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