“enable_annotations on the validator cannot be set as Annotations support is disabled” in symfony

主宰稳场 提交于 2019-12-24 14:25:38

问题


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" on the validator cannot be set as Annotations support is disabled.

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

when i comment both then it becomes a ServiceNotFoundException

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

What is the problem, I am using symfony 3.3.11


回答1:


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.



来源:https://stackoverflow.com/questions/47290778/enable-annotations-on-the-validator-cannot-be-set-as-annotations-support-is-dis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!