Doctrine Symfony2原则:生成:实体抛出语法错误?

Doctrine Symfony2原则:生成:实体抛出语法错误?,doctrine,symfony,entities,Doctrine,Symfony,Entities,当我使用symfony2 shell并尝试运行时 doctrine:generate:entities [MyBundle] --path='src' doctrine:generate:entities [MyBundle] [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property 或 doctrine:

当我使用symfony2 shell并尝试运行时

doctrine:generate:entities [MyBundle] --path='src' 
doctrine:generate:entities [MyBundle] 
[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property

doctrine:generate:entities [MyBundle] --path='src' 
doctrine:generate:entities [MyBundle] 
[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property
我遇到了这个错误

doctrine:generate:entities [MyBundle] --path='src' 
doctrine:generate:entities [MyBundle] 
[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property
因此,请提供任何解决方案??


提前谢谢

我也遇到了这个错误。这只是一个简单的实体注释输入错误。快速检查您的实体将发现如下情况:

/**
 * @ORM\Id
 * @ORM\Column(type="integer"              // note the missing close parentheses
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id;

考虑到行号,它可能位于某个实体关联映射中。

正如cantera所说,检查大括号

以下是一些symfony注释错误:

逗号

  • 示例代码:@ORM\Column(name=“Column\u name”type=“string”length=20 nullable=false)
  • 错误消息:[语法错误]应为条令\Common\Annotations\DocLexer::T\u CLOSE\u圆括号,在属性中的位置62处获得“type”
使用错误的类型

  • 示例代码:@ORM\Column(name=“Column\u name”,type=“string”,length=“20”,nullable=false)
  • 错误消息:[类型错误]属性上声明的@ORM\列的属性“长度”

检查注释的语法?