Skip to content

Commit ea1e1d7

Browse files
author
Anton
authored
Merge pull request #18 from bluzphp/develop
Migrate to PHP 7.1
2 parents 317cc41 + 7f60d9a commit ea1e1d7

File tree

10 files changed

+31
-46
lines changed

10 files changed

+31
-46
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
language: php
22
php:
3-
- 7.0
43
- 7.1
54
- 7.2
65
- master
76
matrix:
87
allow_failures:
9-
- php: 7.2
108
- php: master
119
env:
1210
- BLUZ_MODULE=test

application/models/Test/ArrayGrid.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class ArrayGrid extends Grid
2222
protected $uid = 'arr';
2323

2424
/**
25-
* init
26-
*
27-
* @return self
25+
* {@inheritdoc}
2826
*/
29-
public function init()
27+
public function init() : void
3028
{
3129
// Source of grid
3230
$adapter = new ArraySource();
@@ -49,7 +47,5 @@ public function init()
4947
$this->setDefaultLimit(3);
5048
$this->setAllowOrders(['name', 'email', 'id']);
5149
$this->setAllowFilters(['name', 'status', 'id']);
52-
53-
return $this;
5450
}
5551
}

application/models/Test/Row.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Row extends \Bluz\Db\Row
3535
*
3636
* @return void
3737
*/
38-
protected function beforeSave()
38+
protected function beforeSave() : void
3939
{
4040
// name validator
4141
$this->addValidator('name')

application/models/Test/SelectGrid.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ class SelectGrid extends Grid
2323
protected $uid = 'sel';
2424

2525
/**
26-
* init
27-
*
28-
* @return self
26+
* {@inheritdoc}
2927
*/
30-
public function init()
28+
public function init() : void
3129
{
3230
// Source of grid
3331
$adapter = new SelectSource();
@@ -41,7 +39,5 @@ public function init()
4139
$this->setDefaultLimit(15);
4240
$this->setAllowOrders(['name', 'id', 'status']);
4341
$this->setAllowFilters(['status', 'id']);
44-
45-
return $this;
4642
}
4743
}

application/models/Test/SqlGrid.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class SqlGrid extends Grid
2222
protected $uid = 'sql';
2323

2424
/**
25-
* init
26-
*
27-
* @return self
25+
* {@inheritdoc}
2826
*/
29-
public function init()
27+
public function init() : void
3028
{
3129
// Source of grid
3230
$adapter = new SqlSource();
@@ -37,7 +35,5 @@ public function init()
3735
$this->setAllowOrders(['name', 'id', 'status']);
3836
$this->setAllowFilters(['status', 'id']);
3937
$this->setDefaultOrder('name', Grid::ORDER_DESC);
40-
41-
return $this;
4238
}
4339
}

application/models/Test/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Table extends \Bluz\Db\Table
3333
*
3434
* @var array
3535
*/
36-
protected $primary = array('id');
36+
protected $primary = ['id'];
3737

3838
/**
3939
* save test row

application/models/Test/TableGrid.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class TableGrid extends Grid
2222
protected $uid = 'tbl';
2323

2424
/**
25-
* init
26-
*
27-
* @return self
25+
* {@inheritdoc}
2826
*/
29-
public function init()
27+
public function init() : void
3028
{
3129
// Source of grid
3230
$adapter = new SelectSource();
@@ -39,7 +37,5 @@ public function init()
3937
$this->setDefaultLimit(15);
4038
$this->setAllowOrders(['name', 'id', 'status']);
4139
$this->setAllowFilters(['status', 'id']);
42-
43-
return $this;
4440
}
4541
}

application/modules/test/controllers/rest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace Application;
1212

1313
use Application\Test;
14-
use Bluz\Application\Exception\ForbiddenException;
14+
use Bluz\Http\Exception\ForbiddenException;
1515
use Bluz\Controller\Controller;
1616
use Bluz\Controller\Mapper\Rest;
1717

application/modules/test/views/grid-array.phtml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ if (!$grid) {
1212
// use data-spy="grid" for use AJAX for reload grid
1313
require(['bluz.grid']);
1414
</script>
15-
<p>
16-
Filters:<br/>
17-
<a href="<?= $grid->filter('id', 'gt', 3) ?>">With Id &gt; 3</a> <br/>
18-
<a href="<?= $grid->filter('id', 'lt', 9) ?>">With Id &lt; 9</a> <br/>
19-
<a href="<?= $grid->filter('id', 'ne', 5, false) ?>">AND Id != 5</a>
20-
</p>
15+
<nav class="navbar navbar-light bg-light justify-content-start">
16+
<a class="navbar-brand" href="#">Filters:</a>
17+
<a href="<?= $grid->filter('id', 'gt', 3) ?>" class="btn btn-info ml-3" data-ajax>With Id &gt; 3</a>
18+
<a href="<?= $grid->filter('id', 'lt', 9) ?>" class="btn btn-info ml-3" data-ajax>With Id &lt; 9</a>
19+
<a href="<?= $grid->filter('id', 'ne', 5, false) ?>" class="btn btn-info ml-3" data-ajax>AND Id != 5</a>
20+
</nav>
21+
2122
<hr/>
2223

2324
<?= $this->partial('grid/total.phtml', ['grid' => $grid]) ?>

application/modules/test/views/grid-sql.phtml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ if (!$grid) {
1414
</script>
1515

1616
<div class="clearfix" data-spy="grid" data-grid="<?= $grid->getUid() ?>">
17-
<p>
18-
Filters:<br/>
19-
<a href="<?= $grid->filter('status', 'eq', 'active') ?>">All Active Users</a> <br/>
20-
<a href="<?= $grid->filter('id', 'gt', 30) ?>">All users with Id &gt; 30</a> <br/>
21-
<a href="<?= $grid->filter('id', 'lt', 70, false) ?>">AND users with Id &lt; 70</a> <br/>
22-
<a href="<?= $grid->filter('status', 'eq', 'active', false) ?>">AND Active Users</a> <br/>
23-
<a href="<?= $grid->filter('id', 'ne', 42, false) ?>">AND without user with Id = 42</a> <br/>
24-
</p>
25-
<div class="input-group">
26-
<a href="<?= $this->url('test', 'crud') ?>" class="btn btn-primary pull-left"
17+
<nav class="navbar navbar-light bg-light justify-content-start">
18+
<a class="navbar-brand ml-3" href="#">Filters:</a>
19+
<a href="<?= $grid->filter('status', 'eq', 'active') ?>" class="btn btn-info ml-3" data-ajax>All Active Users</a>
20+
<a href="<?= $grid->filter('id', 'gt', 30) ?>" class="btn btn-info ml-3" data-ajax>All users with Id &gt; 30</a>
21+
<a href="<?= $grid->filter('id', 'lt', 70, false) ?>" class="btn btn-info ml-3" data-ajax>AND users with Id &lt; 70</a>
22+
<a href="<?= $grid->filter('status', 'eq', 'active', false) ?>" class="btn btn-info ml-3" data-ajax>AND Active Users</a>
23+
<a href="<?= $grid->filter('id', 'ne', 42, false) ?>" class="btn btn-info ml-3" data-ajax>AND without user with Id = 42</a>
24+
</nav>
25+
<hr/>
26+
<nav class="navbar navbar-light bg-light justify-content-start">
27+
<a href="<?= $this->url('test', 'crud') ?>" class="btn btn-primary"
2728
data-ajax-dialog data-ajax-method="get">Create</a>
28-
</div>
29+
</nav>
30+
2931
<hr/>
3032
<?= $this->partial('grid/total.phtml', ['grid' => $grid]) ?>
3133
<?= $this->partial('grid/limit.phtml', ['grid' => $grid]) ?>

0 commit comments

Comments
 (0)