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

OrderItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
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 OrderItem extends DataExtension
7
{
8
    /**
9
     * Apply Guid if absent
10
     */
11
    public function onBeforeWrite()
12
    {
13
        parent::onBeforeWrite();
14
        if (!$this->owner->getField("Guid")) {
15
            $this->owner->Guid = (string) Utils::createGuid();
16
        }
17
    }
18
}
19