I am getting this error in my annotations docblock for Doctrine 2:
Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue, got ')'
After looking for an answer I found this reference Stackoverflow Question 3500125 which in essence says to put quotes around all values in annotations.
With the annotation block I have this does not seem possible. here is my example that is throwing the error.
/**
* @var tags
*
* @ManyToMany(targetEntity="namespace\to\tag")
* @JoinTable(name="content_tag",
* joinColumns={
* @JoinColumn(name="content_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @JoinColumn(name="tag_id", referencedColumnName="id")
* }
* ) // This is the line indicated by the error
*/
private $tags;
If I follow the advice of the answer I found in stack overflow which is to quote out the values, my code will be like this:
/**
* @var tags
*
* @ManyToMany(targetEntity="namespace\to\tag")
* @JoinTable(name="content_tag",
* joinColumns="{
* @JoinColumn(name="content_id", referencedColumnName="id")
* }",
* inverseJoinColumns="{
* @JoinColumn(name="tag_id", referencedColumnName="id")
* }" // Note the extra quotation marks
* )
*/
private $tags;
Which is not right at all.
For people who have come here but not because of doctrine, my mistake was using single quotes instead of double quotes in the @Routes
annotation.
WRONG:
/**
* @Route('/home')
*/
RIGHT
/**
* @Route("/home")
*/
It was a silly mistake, the error string was not very helpful as it pointed to the line i showed in my question as the line that the error was on. The fact was that this entity was extending a parent object, the parent had the @Entity tag but the child did not, i moved it and everything works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With