| 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 | /** |
||
| 29 | * @var array |
||
| 30 | */ |
||
| 31 | private static $has_one = array( |
||
| 32 | 'Product' => 'ProductPage', |
||
| 33 | 'Order' => 'Order' |
||
| 34 | ); |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var array |
||
| 38 | */ |
||
| 39 | private static $many_many = array( |
||
| 40 | 'Options' => 'OptionItem' |
||
| 41 | ); |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var array |
||
| 45 | */ |
||
| 46 | private static $summary_fields = array( |
||
| 47 | 'Product.Title', |
||
| 48 | 'Quantity', |
||
| 49 | 'Price.Nice' |
||
| 50 | ); |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return FieldList |
||
| 54 | */ |
||
| 55 | public function getCMSFields() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param bool $member |
||
| 70 | * @return bool|int |
||
| 71 | */ |
||
| 72 | public function canView($member = false) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param null $member |
||
| 79 | * @return bool |
||
| 80 | */ |
||
| 81 | public function canEdit($member = null) |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @param null $member |
||
| 88 | * @return bool|int |
||
| 89 | */ |
||
| 90 | public function canDelete($member = null) |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @param null $member |
||
| 97 | * @return bool |
||
| 98 | */ |
||
| 99 | public function canCreate($member = null) |
||
| 103 | } |
||
| 104 |
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: