Passed
Push — master ( 97d330...e7fc5b )
by Jason
01:48
created

CustomerExtension::updateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dynamic\Foxy\Orders\Extension;
4
5
use Dynamic\Foxy\Orders\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