Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

AdminList/UserAdminListConfigurator.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\UserManagementBundle\AdminList;
4
5
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\BooleanFilterType;
6
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType;
7
8
/**
9
 * User admin list configurator used to manage {@link User} in the admin
10
 */
11
class UserAdminListConfigurator extends AbstractSettingsAdminListConfigurator
12
{
13
    /**
14
     * Build filters for admin list
15
     */
16
    public function buildFilters()
17
    {
18
        $this->addFilter('username', new StringFilterType('username'), 'kuma_user.users.adminlist.filter.username');
19
        $this->addFilter('email', new StringFilterType('email'), 'kuma_user.users.adminlist.filter.email');
20
        $this->addFilter('enabled', new BooleanFilterType('enabled'), 'kuma_user.users.adminlist.filter.enabled');
21
    }
22
23
    /**
24
     * Configure the visible columns
25
     */
26
    public function buildFields()
27
    {
28
        $this->addField('username', 'kuma_user.users.adminlist.header.username', true);
29
        $this->addField('email', 'kuma_user.users.adminlist.header.email', true);
30
        $this->addField('enabled', 'kuma_user.users.adminlist.header.enabled', true);
31
        $this->addField('lastLogin', 'kuma_user.users.adminlist.header.last_login', false);
32
        $this->addField('groups', 'kuma_user.users.adminlist.header.groups', false);
33
    }
34
35
    /**
36
     * Override path convention (because settings is a virtual admin subtree)
37
     *
38
     * @param string $suffix
0 ignored issues
show
Should the type for parameter $suffix not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
39
     *
40
     * @return string
41
     */
42
    public function getPathByConvention($suffix = null)
43
    {
44
        return 'KunstmaanUserManagementBundle_settings_users' . (empty($suffix) ? '' : '_' . $suffix);
45
    }
46
47
    /**
48
     * Get entity name
49
     *
50
     * @return string
51
     */
52
    public function getEntityName()
53
    {
54
        return 'User';
55
    }
56
}
57