| 1 | <?php |
||
| 3 | class OrderDetail extends DataObject |
||
| 4 | { |
||
| 5 | /** |
||
| 6 | * @var string |
||
| 7 | */ |
||
| 8 | private static $singular_name = 'Order Detail'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private static $plural_name = 'Order Details'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private static $description = ''; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | private static $db = array( |
||
| 24 | 'Quantity' => 'Int', |
||
| 25 | 'Price' => 'Currency' |
||
| 26 | ); |
||
| 27 | |||
| 28 | private static $has_one = array( |
||
| 29 | 'Product' => 'FoxyStripeProduct', |
||
| 30 | 'Order' => 'Order' |
||
| 31 | ); |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | private static $many_many = array( |
||
| 37 | 'Options' => 'OptionItem' |
||
| 38 | ); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | private static $summary_fields = array( |
||
| 44 | 'Product.Title', |
||
| 45 | 'Quantity', |
||
| 46 | 'Price.Nice' |
||
| 47 | ); |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return FieldList |
||
| 51 | */ |
||
| 52 | 1 | public function getCMSFields() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @param bool $member |
||
| 67 | * @return bool|int |
||
| 68 | */ |
||
| 69 | 1 | public function canView($member = false) |
|
| 73 | |||
| 74 | /** |
||
| 75 | * @param null $member |
||
| 76 | * @return bool |
||
| 77 | */ |
||
| 78 | 1 | public function canEdit($member = null) |
|
| 82 | |||
| 83 | /** |
||
| 84 | * @param null $member |
||
| 85 | * @return bool|int |
||
| 86 | */ |
||
| 87 | 1 | public function canDelete($member = null) |
|
| 91 | |||
| 92 | /** |
||
| 93 | * @param null $member |
||
| 94 | * @return bool |
||
| 95 | */ |
||
| 96 | 1 | public function canCreate($member = null) |
|
| 100 | } |
||
| 101 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: