| Total Complexity | 7 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | class OrderAttribute extends DataObject |
||
| 19 | { |
||
| 20 | private static $singular_name = 'Attribute'; |
||
|
|
|||
| 21 | |||
| 22 | private static $plural_name = 'Attributes'; |
||
| 23 | |||
| 24 | private static $db = [ |
||
| 25 | 'CalculatedTotal' => 'Currency', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | private static $has_one = [ |
||
| 29 | 'Order' => Order::class, |
||
| 30 | ]; |
||
| 31 | |||
| 32 | private static $casting = [ |
||
| 33 | 'TableTitle' => 'Text', |
||
| 34 | 'CartTitle' => 'Text', |
||
| 35 | ]; |
||
| 36 | |||
| 37 | private static $table_name = 'SilverShop_OrderAttribute'; |
||
| 38 | |||
| 39 | public function canCreate($member = null, $context = []) |
||
| 40 | { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function canDelete($member = null) |
||
| 47 | } |
||
| 48 | |||
| 49 | public function isLive() |
||
| 50 | { |
||
| 51 | return (!$this->isInDB() || $this->Order()->IsCart()); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Produces a title for use in templates. |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getTableTitle() |
||
| 60 | { |
||
| 61 | $title = $this->i18n_singular_name(); |
||
| 62 | $this->extend('updateTableTitle', $title); |
||
| 63 | return $title; |
||
| 64 | } |
||
| 65 | |||
| 66 | public function getCartTitle() |
||
| 71 | } |
||
| 72 | |||
| 73 | public function ShowInTable() |
||
| 78 | } |
||
| 79 | } |
||
| 80 |