https://github.com/augustomoita/mottapgbundle
Pagination bundle for Symfony
https://github.com/augustomoita/mottapgbundle
actions bootstrap4 excel export pagination pdf php symfony-bundle symfony3
Last synced: 6 months ago
JSON representation
Pagination bundle for Symfony
- Host: GitHub
- URL: https://github.com/augustomoita/mottapgbundle
- Owner: augustomoita
- License: mit
- Created: 2017-11-09T23:52:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-07T13:37:37.000Z (almost 7 years ago)
- Last Synced: 2024-04-24T14:18:55.103Z (about 2 years ago)
- Topics: actions, bootstrap4, excel, export, pagination, pdf, php, symfony-bundle, symfony3
- Language: PHP
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MottaPgBundle
---
#### Installation
- Add via composer
```console
$ composer require agusmoita/mottapg-bundle
```
#### Usage
- Controller
```php
use MottaPgBundle\Util\Paginator\Paginator;
/**
* @Route("/", name="person_index", methods={"GET|POST"})
*/
public function indexAction(Paginator $pg, PersonRepository $repo)
{
return $pg
->setView('person/index.html.twig')
->paginate($repo);
}
```
- Repository
```php
// PersonRepository.php
public function buildQuery($query, $pg)
{
// return SELECT a FROM AppBundle:Person a
return $query;
}
```
- View
```twig
{# person/index.html.twig #}
{% extends '@MottaPg/Paginator/table.html.twig' %}
{% block title %}
List of People
{% endblock %}
{% block paginator_table_header %}
First Name
Last Name
Birthday
{% endblock %}
{% block paginator_table_data %}
{{ entity.firstName }}
{{ entity.lastName }}
{{ entity.birthday|date('m-d-Y') }}
{% endblock %}
```
#### License
[MIT License](LICENSE)