Symfony2 doctrine:generate:实体抛出语法错误?

Ahm*_*ain 7 entities doctrine symfony

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

doctrine:generate:entities [MyBundle] --path='src' 
Run Code Online (Sandbox Code Playgroud)

要么

doctrine:generate:entities [MyBundle] 
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误

[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property
Run Code Online (Sandbox Code Playgroud)

所以请任何解决方案?

提前致谢

can*_*era 31

我也遇到过这个错误.这只是你的一个实体注释中的一个简单错字.快速检查您的实体将显示如下内容:

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

考虑到行号,它可能在您的一个实体关联映射中的某个位置.


San*_*and 8

正如cantera所说,检查花括号.

以下是一些symfony注释错误:

逗号

  • 示例代码:@ORM\Column(name ="column_name"type ="string"length = 20 nullable = false)
  • 错误消息:[语法错误]预期的Doctrine\Common\Annotations\DocLexer :: T_CLOSE_PARENTHESIS,在属性的第62位获得'type'...

使用错误的类型

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