Substring_index function in doctrine ORM(教义 ORM 中的 Substring_index 函数)
问题描述
我必须在 symfony 2 的学说 ORM 中使用 SUBSTRING_INDEX
函数.我该怎么做?现在在查询中使用它会给我未定义的函数错误:
I have to use SUBSTRING_INDEX
function in doctrine ORM in symfony 2. How can I do this? Right now using it inside the query gives me undefined function error:
我使用这个函数来获取第一个数字,例如:
I use this function to get the first number from, for example:
我该如何解决这个问题?
How can I solve this?
推荐答案
这是代表 SUBSTRING_INDEX 函数的类(不要忘记更新命名空间).
Here is class that represent SUBSTRING_INDEX function (don't forget to update namespace).
创建实体管理器前需要先注册:
You need to register it before creating entity manager:
做完之后会得到如下结果:
After you do it you'll get the following results:
这篇关于教义 ORM 中的 Substring_index 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!