|
1 | | -[](https://travis-ci.org/contributte/datagrid-nette-database-data-source) |
2 | | -[](https://packagist.org/packages/contributte/datagrid-nette-database-data-source) |
3 | | -[](https://packagist.org/packages/contributte/datagrid-nette-database-data-source) |
4 | | -[](https://packagist.org/packages/contributte/datagrid-nette-database-data-source) |
5 | | -[](https://gitter.im/ublaboo/help) |
| 1 | + |
| 2 | + |
| 3 | +<p align=center> |
| 4 | + <a href="https://travis-ci.org/contributte/datagrid-nette-database-data-source"><img src="https://img.shields.io/travis/contributte/datagrid-nette-database-data-source.svg?style=flat-square"></a> |
| 5 | + <a href="https://packagist.org/packages/ublaboo/datagrid-nette-database-data-source"><img src="https://badgen.net/packagist/dm/ublaboo/datagrid-nette-database-data-source"></a> |
| 6 | + <a href="https://packagist.org/packages/ublaboo/datagrid-nette-database-data-source"><img src="https://badgen.net/packagist/v/ublaboo/datagrid-nette-database-data-source"></a> |
| 7 | +</p> |
| 8 | +<p align=center> |
| 9 | + <a href="https://packagist.org/packages/ublaboo/datagrid-nette-database-data-source"><img src="https://badgen.net/packagist/php/ublaboo/datagrid-nette-database-data-source"></a> |
| 10 | + <a href="https://github.com/contributte/datagrid-nette-database-data-source"><img src="https://badgen.net/github/license/contributte/datagrid-nette-database-data-source"></a> |
| 11 | + <a href="https://bit.ly/ctteg"><img src="https://badgen.net/badge/support/gitter/cyan"></a> |
| 12 | + <a href="https://bit.ly/cttfo"><img src="https://badgen.net/badge/support/forum/yellow"></a> |
| 13 | + <a href="https://contributte.org/partners.html"><img src="https://badgen.net/badge/sponsor/donations/F96854"></a> |
| 14 | +</p> |
| 15 | + |
| 16 | +<p align=center> |
| 17 | +Website 🚀 <a href="https://contributte.org">contributte.org</a> | Contact 👨🏻💻 <a href="https://f3l1x.io">f3l1x.io</a> | Twitter 🐦 <a href="https://twitter.com/contributte">@contributte</a> |
| 18 | +</p> |
6 | 19 |
|
7 | | -# Nette\Database data source for Nette\Database |
8 | | - |
9 | | -Utility that makes possible to use Nette\Database native query with Ublaboo\DataGrid |
10 | | - |
11 | | -If you are using `Nette\Database` instead of `Nette\Database\Table` (probably because of the need to create more complex queries), there was an option to call `ResultSet::fetchAll()` and operate with that array. |
12 | | - |
13 | | -But why should you fetch `all` data from the database to show just a few of them? |
14 | | - |
15 | | -## Installation |
| 20 | +## Usage |
16 | 21 |
|
17 | | -Download this package using composer: |
| 22 | +To install latest version of `contributte/datagrid-nette-database-data-source` use [Composer](https://getcomposer.com). |
18 | 23 |
|
19 | 24 | ``` |
20 | | -composer require ublaboo/datagrid-nette-database-data-source |
| 25 | +composer install contributte/datagrid-nette-database-data-source |
21 | 26 | ``` |
22 | 27 |
|
23 | | -## Usage |
24 | | - |
25 | | -```php |
26 | | -/** |
27 | | - * @var Nette\Database\Context |
28 | | - * @inject |
29 | | - */ |
30 | | -public $ndb; |
31 | | - |
32 | | - |
33 | | -public function createComponentNetteGrid($name) |
34 | | -{ |
35 | | - /** |
36 | | - * @type Ublaboo\DataGrid\DataGrid |
37 | | - */ |
38 | | - $grid = new DataGrid($this, $name); |
| 28 | +## Documentation |
39 | 29 |
|
40 | | - $query = |
41 | | - 'SELECT p.*, GROUP_CONCAT(v.code SEPARATOR ", ") AS variants |
42 | | - FROM product p |
43 | | - LEFT JOIN product_variant p_v |
44 | | - ON p_v.product_id = p.id |
45 | | - WHERE p.deleted IS NULL |
46 | | - AND (product.status = ? OR product.status = ?)'; |
| 30 | +For details on how to use this package, check out our [documentation](.docs). |
47 | 31 |
|
48 | | - $params = [1, 2]; |
| 32 | +## Versions |
49 | 33 |
|
50 | | - /** |
51 | | - * @var Ublaboo\NetteDatabaseDataSource\NetteDatabaseDataSource |
52 | | - * |
53 | | - * @param Nette\Database\Context |
54 | | - * @param $query |
55 | | - * @param $params|NULL |
56 | | - */ |
57 | | - $datasource = new NetteDatabaseDataSource($this->ndb, $query, $params); |
| 34 | +| State | Version - | Branch | PHP | |
| 35 | +|--------|------------|--------|------| |
| 36 | +| dev | dev-master | master | ^7.2 | |
| 37 | +| stable | ~2.0.0 | master | ^7.2 | |
| 38 | +| stable | ~1.1.0 | master | ^5.6 | |
58 | 39 |
|
59 | | - $grid->setDataSource($datasource); |
60 | 40 |
|
61 | | - $grid->addColumnText('name', 'Name') |
62 | | - ->setSortable(); |
| 41 | +## Development |
63 | 42 |
|
64 | | - $grid->addColumnNumber('id', 'Id') |
65 | | - ->setSortable(); |
| 43 | +See [how to contribute](https://contributte.org) to this package. This package is currently maintained by these authors. |
66 | 44 |
|
67 | | - $grid->addColumnDateTime('created', 'Created'); |
| 45 | +<a href="https://github.com/paveljanda"> |
| 46 | + <img width="80" height="80" src="https://avatars0.githubusercontent.com/u/1488874?v=3&s=80"> |
| 47 | +</a> |
68 | 48 |
|
69 | | - $grid->addFilterDateRange('created', 'Created:'); |
| 49 | +----- |
70 | 50 |
|
71 | | - $grid->addFilterText('name', 'Name and id', ['id', 'name']); |
72 | | - |
73 | | - $grid->addFilterSelect('status', 'Status', ['' => 'All', 1 => 'Online', 0 => 'Ofline', 2 => 'Standby']); |
74 | | - |
75 | | - /** |
76 | | - * Etc |
77 | | - */ |
78 | | -} |
79 | | -``` |
| 51 | +Consider to [support](https://contributte.com/partners) **contributte** development team. |
| 52 | +Also thank you for using this package. |
0 commit comments