| Total Complexity | 2 | 
| Total Lines | 72 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 8 | class DiscountTier extends DataObject  | 
            ||
| 9 | { | 
            ||
| 10 | /**  | 
            ||
| 11 | * @var array  | 
            ||
| 12 | */  | 
            ||
| 13 | private static $db = [  | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 14 | 'Quantity' => 'Int',  | 
            ||
| 15 | 'Percentage' => 'Int',  | 
            ||
| 16 | ];  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * @var array  | 
            ||
| 20 | */  | 
            ||
| 21 | private static $has_one = [  | 
            ||
| 22 | 'Discount' => Discount::class,  | 
            ||
| 23 | ];  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * @var array  | 
            ||
| 27 | */  | 
            ||
| 28 | private static $defaults = [  | 
            ||
| 29 | 'Quantity' => 1,  | 
            ||
| 30 | ];  | 
            ||
| 31 | |||
| 32 | /**  | 
            ||
| 33 | * @var array  | 
            ||
| 34 | */  | 
            ||
| 35 | private static $summary_fields = [  | 
            ||
| 36 | 'DiscountPercentage' => [  | 
            ||
| 37 | 'title' => 'Discount',  | 
            ||
| 38 | ],  | 
            ||
| 39 | 'Quantity',  | 
            ||
| 40 | ];  | 
            ||
| 41 | |||
| 42 | /**  | 
            ||
| 43 | * @var string  | 
            ||
| 44 | */  | 
            ||
| 45 | private static $table_name = 'FoxyDiscountTier';  | 
            ||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * @var array  | 
            ||
| 49 | */  | 
            ||
| 50 | private static $default_sort = array(  | 
            ||
| 51 | 'Quantity'  | 
            ||
| 52 | );  | 
            ||
| 53 | |||
| 54 | /**  | 
            ||
| 55 | * @return FieldList|void  | 
            ||
| 56 | */  | 
            ||
| 57 | public function getCMSFields()  | 
            ||
| 58 |     { | 
            ||
| 59 |         $this->beforeUpdateCMSFields(function (FieldList $fields) { | 
            ||
| 60 | $fields->removeByName([  | 
            ||
| 61 | 'DiscountID',  | 
            ||
| 62 | ]);  | 
            ||
| 63 | |||
| 64 |             $quantity = $fields->dataFieldByName('Quantity'); | 
            ||
| 65 |             $quantity->setTitle('Quantity to trigger discount'); | 
            ||
| 66 | |||
| 67 |             $percentage = $fields->dataFieldByName('Percentage'); | 
            ||
| 68 |             $percentage->setTitle('Percent discount'); | 
            ||
| 69 | });  | 
            ||
| 70 | |||
| 71 | return parent::getCMSFields();  | 
            ||
| 72 | }  | 
            ||
| 73 | |||
| 74 | /**  | 
            ||
| 75 | * @return string  | 
            ||
| 76 | */  | 
            ||
| 77 | public function getDiscountPercentage()  | 
            ||
| 80 | }  | 
            ||
| 81 | }  | 
            ||
| 82 |