jrk/easypagination-bundle

为 symfony2/3 优化的 easypagination 包

安装: 200

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master / 1.0.x-dev 2018-12-11 22:51 UTC

This package is not auto-updated.

Last update: 2024-09-26 23:50:25 UTC


README

配置

JRKEasyPaginationBundle 需要 Pagerfanta api 文件夹

  • 使用 composer

在项目的 composer.json 文件中将 jrk/easypagination-bundle 添加为依赖

{
    "require": {
        "jrk/easypagination-bundle": "dev-master"
    }
}

更新 composer

php composer update
or 
php composer.phar update


- Add JRKEasyPaginationBundle to your application kernel

``` php
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new JRK\EasyPaginationBundle\JRKEasyPaginationBundle(),
    );
}

使用方法

  • 使用服务

打开您的控制器并调用服务。

<?php
    list($entities, $counter, $pager, $pagerHtml) =  $this->get('jrk_easypagination')->paginate(
        $queryBuilder,      // QueryBuilder
        array('args' => array('limit' => $limit), 'route' => self::$route_list),  // Route for HTML widget
        $limit,     // Number of items per page
        false,      // OutOfRangeException quiet or not
        $page,      // The page number (by default it will check for "page" attribute in the request)
        true        // If you need the HTML widget
    );
?>