Completed
Push — master ( 99fabc...2588e6 )
by Jason
01:54
created

CustomerExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 5 1
1
<?php
2
3
namespace Dynamic\Foxy\Extension;
4
5
use Dynamic\Foxy\Model\Order;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\TextField;
8
use SilverStripe\ORM\DataExtension;
9
10
class CustomerExtension extends DataExtension
11
{
12
    /**
13
     * @var array
14
     */
15
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
16
        'Customer_ID' => 'Int', // ID from Foxy system
17
    ];
18
19
    /**
20
     * @var array
21
     */
22
    private static $has_many = [
0 ignored issues
show
introduced by
The private property $has_many is not used, and could be removed.
Loading history...
23
        'Orders' => Order::class,
24
    ];
25
26
    /**
27
     * @var array
28
     */
29
    private static $indexes = [
0 ignored issues
show
introduced by
The private property $indexes is not used, and could be removed.
Loading history...
30
        'Customer_ID' => true, // make unique
31
    ];
32
33
    /**
34
     * @param FieldList $fields
35
     */
36
    public function updateCMSFields(FieldList $fields)
37
    {
38
        $fields->replaceField(
39
            'Customer_ID',
40
            TextField::create('Customer_ID')->performReadonlyTransformation()
41
        );
42
    }
43
}
44