Completed
Push — master ( ab63ad...2d5693 )
by Nic
13s queued 10s
created

DiscountAdmin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getList() 0 11 2
1
<?php
2
3
namespace Dynamic\Foxy\Discounts\Admin;
4
5
use Dynamic\Foxy\Discounts\Model\Discount;
6
use SilverStripe\Admin\ModelAdmin;
7
use SilverStripe\ORM\DataList;
8
use SilverStripe\Security\Member;
9
10
/**
11
 * Class DiscountAdmin
12
 * @package Dynamic\Foxy\Discounts\Admin
13
 */
14
class DiscountAdmin extends ModelAdmin
15
{
16
    /**
17
     * @var array
18
     */
19
    private static $managed_models = [
0 ignored issues
show
introduced by
The private property $managed_models is not used, and could be removed.
Loading history...
20
        Discount::class,
21
    ];
22
23
    /**
24
     * @var string
25
     */
26
    private static $url_segment = 'discounts';
0 ignored issues
show
introduced by
The private property $url_segment is not used, and could be removed.
Loading history...
27
28
    /**
29
     * @var string
30
     */
31
    private static $menu_title = 'Discounts';
0 ignored issues
show
introduced by
The private property $menu_title is not used, and could be removed.
Loading history...
32
33
    /**
34
     * @return DataList
35
     */
36
    public function getList()
37
    {
38
        $list = parent::getList();
39
40
        $excludeIDs = Member::get()->columnUnique('DiscountID');
41
42
        if (count($excludeIDs)) {
43
            $list = $list->exclude('ID', $excludeIDs);
44
        }
45
46
        return $list;
47
    }
48
}
49