生成getter和setter时出错

时间:2013-07-04 16:37:27

标签: symfony

执行此操作后:php app/console doctrine:generate:entities Datacenter

我收到以下错误:

  [Doctrine\Common\Annotations\AnnotationException]
  [Semantical Error] The annotation "@validation:Validation" in property Datacenter\AssetsManagerBundle\
  Entity\CommentDoc::$name was never imported. Did you maybe forget to add a "use" statement for this an
  notation?

顺便说一句,我正在关注官方文件http://sonata-project.org/bundles/doctrine-orm-admin/2-0/doc/tutorial/creating_your_first_admin_class/defining_entities.html

在生成getter和setter时它会中断:p

任何想法? :)

1 个答案:

答案 0 :(得分:0)

错误是明确的:Did you maybe forget to add a "use" statement for this an notation?

将此添加到CommentDoc类

use Symfony\Component\Validator\Constraints as validation;

请参阅http://symfony.com/doc/current/book/validation.html

希望它有用

最好的关注