Completed
Branch master (e562f1)
by Antony
02:11
created

OrderModifier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A onBeforeWrite() 0 5 2
1
<?php namespace AntonyThorpe\SilvershopUnleashed;
2
3
//use AntonyThorpe\SilverShopUnleashed\Utils;
4
use SilverStripe\ORM\DataExtension;
5
6
class OrderModifier extends DataExtension
7
{
8
    /**
9
     * Map OrderModifier
10
     * @var string
11
     */
12
    private static $product_code;
0 ignored issues
show
introduced by
The private property $product_code is not used, and could be removed.
Loading history...
13
14
    /**
15
     * Apply Guid if absent
16
     */
17
    public function onBeforeWrite()
18
    {
19
        parent::onBeforeWrite();
20
        if (!$this->owner->getField("Guid")) {
21
            $this->owner->Guid = (string) Utils::createGuid();
22
        }
23
    }
24
}
25