Escape " in Annotation
Is it possible to protect a quotation mark, for example, with a ""?
Like this:
<?php
/**
* @Unique(fields={"name"}, message="The name \"{{ value }}\" is already in use!")
*/
class User {}
Hi @Baachi
I think so :)
Could you add this issue on jira please ? http://www.doctrine-project.org/jira/
Thanks..
To escape a quotation mark, you can double it.
Thanks @stof .
But i think the backslash would be better, or what do you think?
The current escaping format is a double ". Won't change in 2.x
how do I get rid on the backslashes the double " adds to my example?
I want to know if I can get ideas in these two areas: 1: Is it possible to do this by overriding the AnnotationReader class, but I'm not sure what his specific implementation idea is, and there are many details to be aware of. 2: php syntax support, such as string type can be achieved using a delimiter such as <<< EOF.
Ad 1: For the upcoming Annotations 2.0 it's planned to switch to \ as an escape character. This can't to be done in 1.x.
Ad 2: If you have some proposals, I'd suggest to open an issue over on doctrine/annotations repo instead of discussing it here in a old, closed issue.