Issues (52)

application/models/Transactions/Grid.php (2 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link      https://github.com/bluzphp/skeleton
6
 */
7
8
namespace Application\Transactions;
9
10
use Bluz\Grid\Source\SelectSource;
0 ignored issues
show
The type Bluz\Grid\Source\SelectSource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
/**
13
 * Grid based on Table
14
 *
15
 * @package  Application\Transactions
16
 *
17
 * @author   Anton Shevchuk
18
 * @created  2017-10-19 15:29:44
19
 */
20
class Grid extends \Bluz\Grid\Grid
0 ignored issues
show
The type Bluz\Grid\Grid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $uid = 'transactions';
26
27
    /**
28
     * @return void
29
     * @throws \Bluz\Grid\GridException
30
     */
31
    public function init(): void
32
    {
33
        // Build select
34
        $select = Table::select()
35
            ->addSelect('users.login AS login')
36
            ->addSelect('usersChain.login AS chainLogin')
37
            ->leftJoin('transactions', 'users', 'users', 'users.id = transactions.userId')
38
            ->leftJoin('transactions', 'users', 'usersChain', 'usersChain.id = transactions.chainUserId')
39
        ;
40
41
        // Current table as source of grid
42
        $adapter = new SelectSource();
43
        $adapter->setSource($select);
44
45
        $this->addAlias('users.id', 'user');
46
        $this->addAlias('users.login', 'login');
47
48
        $this->setAdapter($adapter);
49
        $this->setDefaultLimit(25);
50
        $this->setAllowFilters(['users.id', 'type']);
51
        $this->setAllowOrders(['type', 'amount', 'created', 'users.login']);
52
    }
53
}
54