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

    1. <tfoot id='cqKzK'></tfoot>
        <bdo id='cqKzK'></bdo><ul id='cqKzK'></ul>

    2. <legend id='cqKzK'><style id='cqKzK'><dir id='cqKzK'><q id='cqKzK'></q></dir></style></legend>
    3. <i id='cqKzK'><tr id='cqKzK'><dt id='cqKzK'><q id='cqKzK'><span id='cqKzK'><b id='cqKzK'><form id='cqKzK'><ins id='cqKzK'></ins><ul id='cqKzK'></ul><sub id='cqKzK'></sub></form><legend id='cqKzK'></legend><bdo id='cqKzK'><pre id='cqKzK'><center id='cqKzK'></center></pre></bdo></b><th id='cqKzK'></th></span></q></dt></tr></i><div id='cqKzK'><tfoot id='cqKzK'></tfoot><dl id='cqKzK'><fieldset id='cqKzK'></fieldset></dl></div>

      如何使用具有比较标准的 findBy 方法

      How to use a findBy method with comparative criteria(如何使用具有比较标准的 findBy 方法)

          <tbody id='tpoJz'></tbody>
      1. <small id='tpoJz'></small><noframes id='tpoJz'>

          • <bdo id='tpoJz'></bdo><ul id='tpoJz'></ul>
            <i id='tpoJz'><tr id='tpoJz'><dt id='tpoJz'><q id='tpoJz'><span id='tpoJz'><b id='tpoJz'><form id='tpoJz'><ins id='tpoJz'></ins><ul id='tpoJz'></ul><sub id='tpoJz'></sub></form><legend id='tpoJz'></legend><bdo id='tpoJz'><pre id='tpoJz'><center id='tpoJz'></center></pre></bdo></b><th id='tpoJz'></th></span></q></dt></tr></i><div id='tpoJz'><tfoot id='tpoJz'></tfoot><dl id='tpoJz'><fieldset id='tpoJz'></fieldset></dl></div>
            <tfoot id='tpoJz'></tfoot>
              <legend id='tpoJz'><style id='tpoJz'><dir id='tpoJz'><q id='tpoJz'></q></dir></style></legend>
                本文介绍了如何使用具有比较标准的 findBy 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要使用使用比较标准(不仅是精确标准)的魔术查找器" findBy 方法.换句话说,我需要做这样的事情:

                I'd need to use a "magic finder" findBy method using comparative criteria (not only exact criteria). In other words, I need to do something like this:

                $result = $purchases_repository->findBy(array("prize" => ">200"));
                

                这样我就可以购买所有奖励超过 200 的商品.

                so that I'd get all purchases where the prize is above 200.

                推荐答案

                这是一个使用 Expr() Class - 几天前我也需要这个,我花了一些时间才知道确切的语法是什么及使用方式:

                This is an example using the Expr() Class - I needed this too some days ago and it took me some time to find out what is the exact syntax and way of usage:

                /**
                 * fetches Products that are more expansive than the given price
                 * 
                 * @param int $price
                 * @return array
                 */
                public function findProductsExpensiveThan($price)
                {
                  $em = $this->getEntityManager();
                  $qb = $em->createQueryBuilder();
                
                  $q  = $qb->select(array('p'))
                           ->from('YourProductBundle:Product', 'p')
                           ->where(
                             $qb->expr()->gt('p.price', $price)
                           )
                           ->orderBy('p.price', 'DESC')
                           ->getQuery();
                
                  return $q->getResult();
                }
                

                这篇关于如何使用具有比较标准的 findBy 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                How to parse django style template tags(如何解析 django 样式模板标签)
                What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                php in background exec() function(php 后台 exec() 函数)

                    <bdo id='7tSWn'></bdo><ul id='7tSWn'></ul>
                    <tfoot id='7tSWn'></tfoot>

                    1. <small id='7tSWn'></small><noframes id='7tSWn'>

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

                          <legend id='7tSWn'><style id='7tSWn'><dir id='7tSWn'><q id='7tSWn'></q></dir></style></legend>
                            <tbody id='7tSWn'></tbody>