问题
when i am using the symfony2 shell and trying to run
doctrine:generate:entities [MyBundle] --path='src'
or
doctrine:generate:entities [MyBundle]
i got this error
[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES, got '@' at position 255 in property
so please any solutions ??
thanks in advance
回答1:
I've encountered this error also. It's just a simple typo in one of your Entity annotations. A quick check of your entities will reveal something like this:
/**
* @ORM\Id
* @ORM\Column(type="integer" // note the missing close parentheses
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
Taking into account the line number, it's probably somewhere in one of your entity association mappings.
回答2:
Just as cantera says, check the curly braces.
Here are some of symfony annotation errors:
The comma
- Sample Code: @ORM\Column(name="column_name" type="string" length=20 nullable=false)
- Error Message: [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got 'type' at position 62 in property ...
Using the wrong type
- Sample Code: @ORM\Column(name="column_name", type="string", length="20", nullable=false)
- Error Message: [Type Error] Attribute "length" of @ORM\Column declared on property ...
来源:https://stackoverflow.com/questions/9273299/symfony2-doctrinegenerateentities-throw-syntax-error