Passed
Pull Request — master (#99)
by Nic
02:51
created

VariationType::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Dynamic\Foxy\Model;
4
5
use SilverStripe\Forms\FieldList;
6
use SilverStripe\ORM\DataObject;
7
8
/**
9
 * Class VariationType
10
 * @package Dynamic\Foxy\Model
11
 */
12
class VariationType extends DataObject
13
{
14
    /**
15
     * @var string
16
     */
17
    private static $table_name = 'VariationType';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
18
19
    /**
20
     * @var string
21
     */
22
    private static $singular_name = 'Variation Type';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
23
24
    /**
25
     * @var string
26
     */
27
    private static $plural_name = 'Variation Types';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
28
29
    /**
30
     * @var string[]
31
     */
32
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
33
        'Title' => 'Varchar',
34
        'SortOrder' => 'Int',
35
    ];
36
37
    /**
38
     * @var string[]
39
     */
40
    private static $has_many = [
0 ignored issues
show
introduced by
The private property $has_many is not used, and could be removed.
Loading history...
41
        'Variations' => Variation::class,
42
    ];
43
44
    /**
45
     * @var string
46
     */
47
    private static $default_sort = 'SortOrder';
0 ignored issues
show
introduced by
The private property $default_sort is not used, and could be removed.
Loading history...
48
49
    /**
50
     * @return FieldList
51
     */
52
    public function getCMSFields()
53
    {
54
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
55
            $fields->removeByName([
56
                'VariationSets',
57
            ]);
58
        });
59
60
        return parent::getCMSFields();
61
    }
62
}
63