• <bdo id='ugQ8D'></bdo><ul id='ugQ8D'></ul>
  • <legend id='ugQ8D'><style id='ugQ8D'><dir id='ugQ8D'><q id='ugQ8D'></q></dir></style></legend>

      <small id='ugQ8D'></small><noframes id='ugQ8D'>

      <i id='ugQ8D'><tr id='ugQ8D'><dt id='ugQ8D'><q id='ugQ8D'><span id='ugQ8D'><b id='ugQ8D'><form id='ugQ8D'><ins id='ugQ8D'></ins><ul id='ugQ8D'></ul><sub id='ugQ8D'></sub></form><legend id='ugQ8D'></legend><bdo id='ugQ8D'><pre id='ugQ8D'><center id='ugQ8D'></center></pre></bdo></b><th id='ugQ8D'></th></span></q></dt></tr></i><div id='ugQ8D'><tfoot id='ugQ8D'></tfoot><dl id='ugQ8D'><fieldset id='ugQ8D'></fieldset></dl></div>

        <tfoot id='ugQ8D'></tfoot>

        在 Doctrine 2.x ORM 中使用 REGEXP

        Using REGEXP in Doctrine 2.x ORM(在 Doctrine 2.x ORM 中使用 REGEXP)
          • <bdo id='0op5V'></bdo><ul id='0op5V'></ul>
              <tbody id='0op5V'></tbody>

            <small id='0op5V'></small><noframes id='0op5V'>

          • <tfoot id='0op5V'></tfoot>

              <i id='0op5V'><tr id='0op5V'><dt id='0op5V'><q id='0op5V'><span id='0op5V'><b id='0op5V'><form id='0op5V'><ins id='0op5V'></ins><ul id='0op5V'></ul><sub id='0op5V'></sub></form><legend id='0op5V'></legend><bdo id='0op5V'><pre id='0op5V'><center id='0op5V'></center></pre></bdo></b><th id='0op5V'></th></span></q></dt></tr></i><div id='0op5V'><tfoot id='0op5V'></tfoot><dl id='0op5V'><fieldset id='0op5V'></fieldset></dl></div>

            1. <legend id='0op5V'><style id='0op5V'><dir id='0op5V'><q id='0op5V'></q></dir></style></legend>

                • 本文介绍了在 Doctrine 2.x ORM 中使用 REGEXP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对此进行了大量研究,我确定答案是否定的,但我很想证明自己是错的.

                  I've research this a great deal and I'm sure the answer is no, but I'd love to proven wrong.

                  我想执行一个用 DQL 编写的包含 REGEXP 操作的查询.例如:

                  I'd like to execute a query written in DQL that contains the REGEXP operation. For example:

                  select * from assets 
                  where campaign_id = 1
                  and fileName REGEXP 'godzilla*'
                  order by fileName desc
                  

                  又名

                  $builder->add('select', 'a.fileName')
                          ->add('from',    'CompanyBundleEntityAsset a')
                          ->add('where',   'a.campaign=1')
                          ->...REGEXP MAGIC...
                          ->add('orderBy', 'a.fileName desc');
                  

                  (这是一个简单的正则表达式,我意识到可以用 LIKE 来完成,但这只是一个例子 - 我真正的正则表达式更复杂)

                  (This is a simple regex and I realize could be done as a LIKE, but it's just an example - my real regex expression is more complicated)

                  我研究了 DoctrineORMQueryExpr 类,以及 QueryBuilder 类.我看不到对 REGEXP 的支持.SO 上有人发帖说他们使用了 Expr 类,但这实际上不起作用(他们说它未经测试).

                  I've looked into the DoctrineORMQueryExpr class, plus the QueryBuilder class. I see no support for REGEXP. Someone on SO has a post saying they used the Expr class, but this doesn't actually work (they stated it was untested).

                  知道如何在不直接编写 SQL 的情况下在 DQL 中执行 REGEXP 吗?TIA.

                  Any idea how to execute REGEXP in DQL w/out writing straight SQL? TIA.

                  推荐答案

                  问题不在于查询生成器无法为 MySQL 中的(非标准)REGEXP 功能创建查询,而在于即使您可以生成查询,DQL 解析器不可能不做任何处理就理解它.

                  The issue is not so much that Query Builder cannot create queries for the (non-standard) REGEXP functionality in MySQL but more that even if you can generate your query, there is no way the DQL parser will understand it without doing something about it.

                  那个东西"正在扩展 Doctrine 的 DQL 以理解正则表达式语法.这可以通过扩展 DQL 来实现,如在博文.

                  That "something" is extending Doctrine’s DQL to understand the regular expression syntax. This is doable by extending the DQL as described in a blog post.

                  有关更多信息,请研究 DoctrineExtensions 的 MySQL 部分的代码

                  For more information study the code of the MySQL part of DoctrineExtensions

                  这篇关于在 Doctrine 2.x ORM 中使用 REGEXP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <tfoot id='dxJYd'></tfoot>
                  1. <legend id='dxJYd'><style id='dxJYd'><dir id='dxJYd'><q id='dxJYd'></q></dir></style></legend>

                    <small id='dxJYd'></small><noframes id='dxJYd'>

                          • <bdo id='dxJYd'></bdo><ul id='dxJYd'></ul>

                              <tbody id='dxJYd'></tbody>

                            <i id='dxJYd'><tr id='dxJYd'><dt id='dxJYd'><q id='dxJYd'><span id='dxJYd'><b id='dxJYd'><form id='dxJYd'><ins id='dxJYd'></ins><ul id='dxJYd'></ul><sub id='dxJYd'></sub></form><legend id='dxJYd'></legend><bdo id='dxJYd'><pre id='dxJYd'><center id='dxJYd'></center></pre></bdo></b><th id='dxJYd'></th></span></q></dt></tr></i><div id='dxJYd'><tfoot id='dxJYd'></tfoot><dl id='dxJYd'><fieldset id='dxJYd'></fieldset></dl></div>