使用 Doctrine 2 自动引用保留字 [英] Auto quote reserved words with Doctrine 2
问题描述
在使用 $entityManager->find('entity', id)
时,有没有办法用 Doctrine 2 自动引用保留字?
Is there a way to auto quote reserved words with Doctrine 2 when using $entityManager->find('entity', id)
?
当使用查询构建器时,这可以完成,但应该有一个全局配置设置来做到这一点?我不想在保留字的注释中指定它.
When using the query builder this can be done but there should be a global configuration setting that does this? I don't want to have to specify it in the annotations for the reserved words.
推荐答案
这是我不久前向 Doctrine 团队提出的一个问题.
This was an issue I raised a while back with the Doctrine team.
https://github.com/doctrine/doctrine2/issues/2409
票已关闭并附有评论:
您必须使用@Column(name="`integer`") 手动转义字符
You have to manually escape characters with @Column(name="`integer`")
所以我猜你需要处理注释中的任何保留关键字
So I guess you'd need to deal with any reserved keywords in your annotations
这篇关于使用 Doctrine 2 自动引用保留字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!