<tfoot id='nHD9E'></tfoot>
  • <small id='nHD9E'></small><noframes id='nHD9E'>

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

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

        <legend id='nHD9E'><style id='nHD9E'><dir id='nHD9E'><q id='nHD9E'></q></dir></style></legend>

      1. 学说 2 和 Zend 分页器

        时间:2023-10-02
          <i id='OsiLG'><tr id='OsiLG'><dt id='OsiLG'><q id='OsiLG'><span id='OsiLG'><b id='OsiLG'><form id='OsiLG'><ins id='OsiLG'></ins><ul id='OsiLG'></ul><sub id='OsiLG'></sub></form><legend id='OsiLG'></legend><bdo id='OsiLG'><pre id='OsiLG'><center id='OsiLG'></center></pre></bdo></b><th id='OsiLG'></th></span></q></dt></tr></i><div id='OsiLG'><tfoot id='OsiLG'></tfoot><dl id='OsiLG'><fieldset id='OsiLG'></fieldset></dl></div>
            <bdo id='OsiLG'></bdo><ul id='OsiLG'></ul>
                <tbody id='OsiLG'></tbody>
              <legend id='OsiLG'><style id='OsiLG'><dir id='OsiLG'><q id='OsiLG'></q></dir></style></legend>

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

                  <tfoot id='OsiLG'></tfoot>
                1. 本文介绍了学说 2 和 Zend 分页器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想在 zend_paginator 中使用学说

                  i want to use doctrine with zend_paginator

                  这里有一些示例查询:

                  $allArticleObj =$this->_em->getRepository('文章');$qb = $this->_em->createQueryBuilder();

                  $allArticleObj = $this->_em->getRepository('Articles'); $qb = $this->_em->createQueryBuilder();

                      $qb->add('select', 'a')
                              ->add('from', 'Articles a')
                              ->setFirstResult(0)
                              ->setMaxResults(5);
                  

                  是否有任何示例代码表明我们可以为 Dotct 2 查询构建器编写 zend_paginator 适配器?

                  is there any example code to show we can write a zend_paginator adapter for doctrine 2 query builder?

                  推荐答案

                  结果当然是你必须实现Zend_Paginator_Adapter_Interface,这实质上意味着实现两个方法:

                  The upshot, of course, is that you have to implement the Zend_Paginator_Adapter_Interface, which essentially means implementing the two methods:

                  count()

                  getItems($offset, $perPage)

                  您的适配器将接受 Doctrine 查询作为构造函数参数.

                  Your adapter would accept the Doctrine query as a constructor argument.

                  原则上,getItems() 部分实际上很简单.只需将 $offset$perPage 限制添加到查询中 - 正如您在示例中所做的 - 并执行查询.

                  In principle, the getItems() part is actually straightforward. Simply, add the $offset and $perPage restrictions to the query - as you are doing in your sample - and execute the query.

                  在实践中,count() 业务往往很棘手.我会遵循 Zend_Paginator_Adapter_DbSelect 的例子,用它们的 Doctrine 类似物替换 Zend_Db 操作.

                  In practice, it's the count() business that tends to be tricky. I'd follow the example of Zend_Paginator_Adapter_DbSelect, replacing the Zend_Db operations with their Doctrine analogues.

                  这篇关于学说 2 和 Zend 分页器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Linux 上的 PHP 5.4:如何连接 MS SQL Server 2008? 下一篇:Zend_Db:如何通过 SSH 隧道连接到 MySQL 数据库?

                  相关文章

                  最新文章

                2. <legend id='XvsWK'><style id='XvsWK'><dir id='XvsWK'><q id='XvsWK'></q></dir></style></legend>

                    1. <small id='XvsWK'></small><noframes id='XvsWK'>

                        <bdo id='XvsWK'></bdo><ul id='XvsWK'></ul>

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