Issues (400)

application/models/Users/Grid.php (3 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link      https://github.com/bluzphp/skeleton
6
 */
7
8
declare(strict_types=1);
9
10
namespace Application\Users;
11
12
use Bluz\Db\Query\Select;
0 ignored issues
show
The type Bluz\Db\Query\Select 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...
13
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...
14
15
/**
16
 * Grid of Users
17
 *
18
 * @method   Row[] getData()
19
 *
20
 * @package  Application\Users
21
 */
22
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...
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $uid = 'users';
28
29
    /**
30
     * {@inheritdoc}
31
     * @throws \Bluz\Grid\GridException
32 1
     */
33
    public function init(): void
34
    {
35 1
        // Create Select
36 1
        $select = Table::select();
37 1
        $select->select('users.*, GROUP_CONCAT( ar.`name` SEPARATOR ", " ) AS rolesList')
38 1
            ->leftJoin('users', 'acl_users_roles', 'aur', 'users.`id` = aur.`userId`')
39 1
            ->leftJoin('aur', 'acl_roles', 'ar', 'ar.`id` = aur.`roleId`')
40
            ->groupBy('users.id');
41
42
43 1
        // Setup adapter
44 1
        $adapter = new SelectSource();
45
        $adapter->setSource($select);
46 1
47 1
        $this->addAlias('users.login', 'login');
48 1
        $this->addAlias('users.email', 'email');
49 1
        $this->addAlias('users.status', 'status');
50 1
        $this->addAlias('users.id', 'id');
51
        $this->addAlias('users.roleId', 'role');
52 1
53 1
        $this->setAdapter($adapter);
54 1
        $this->setDefaultLimit(25);
55 1
        $this->setAllowOrders(['login', 'email', 'status', 'id']);
56 1
        $this->setAllowFilters(['login', 'email', 'status', 'id', 'roleId']);
57
    }
58
}
59