1 | <?php |
||
3 | class CatalogProduct extends DataObject implements PermissionProvider, Dynamic\ViewableDataObject\VDOInterfaces\ViewableDataObjectInterface |
||
4 | { |
||
5 | /** |
||
6 | * @var string |
||
7 | */ |
||
8 | private static $singular_name = 'Product'; |
||
9 | |||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private static $plural_name = 'Products'; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private static $db = array( |
||
19 | 'Title' => 'Varchar(255)', |
||
20 | 'Content' => 'HTMLText', |
||
21 | 'QuickFeatures' => 'HTMLText', |
||
22 | 'Dimensions' => 'Varchar(255)', |
||
23 | 'SKU' => 'Varchar(50)', |
||
24 | ); |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $has_many = array( |
||
30 | 'Features' => 'CatalogProductFeature', |
||
31 | ); |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | private static $many_many = array( |
||
37 | 'Categories' => 'CatalogCategory', |
||
38 | 'CareCleaningDocs' => 'CareCleaningDoc', |
||
39 | 'OperationManuals' => 'OperationManual', |
||
40 | 'SpecSheets' => 'SpecSheet', |
||
41 | 'Warranties' => 'Warranty', |
||
42 | ); |
||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | private static $many_many_extraFields = array( |
||
48 | 'Categories' => array( |
||
49 | 'SortOrder' => 'Int', |
||
50 | ), |
||
51 | 'CareCleaningDocs' => array( |
||
52 | 'Sort' => 'Int', |
||
53 | ), |
||
54 | 'OperationManuals' => array( |
||
55 | 'Sort' => 'Int', |
||
56 | ), |
||
57 | 'SpecSheets' => array( |
||
58 | 'Sort' => 'Int', |
||
59 | ), |
||
60 | 'Warranties' => array( |
||
61 | 'Sort' => 'Int', |
||
62 | ), |
||
63 | ); |
||
64 | |||
65 | /** |
||
66 | * @var array |
||
67 | */ |
||
68 | private static $summary_fields = array( |
||
69 | 'Image.CMSThumbnail' => 'Image', |
||
70 | 'Title' => 'Title', |
||
71 | 'Type' => 'Type', |
||
72 | 'CategoryList' => 'Categories', |
||
73 | ); |
||
74 | |||
75 | /** |
||
76 | * @var array |
||
77 | */ |
||
78 | private static $searchable_fields = array( |
||
79 | 'Title' => array( |
||
80 | 'title' => 'Product Name', |
||
81 | ), |
||
82 | 'Categories.ID' => array( |
||
83 | 'title' => 'Category', |
||
84 | ), |
||
85 | ); |
||
86 | |||
87 | /** |
||
88 | * @var array |
||
89 | */ |
||
90 | private static $extensions = [ |
||
91 | 'VersionedDataObject', |
||
92 | ]; |
||
93 | |||
94 | /** |
||
95 | * @param bool $includerelations |
||
96 | * @return array|string |
||
97 | */ |
||
98 | 2 | public function fieldLabels($includerelations = true) |
|
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | 1 | public function CategoryList() |
|
126 | |||
127 | /** |
||
128 | * @return mixed |
||
129 | */ |
||
130 | 1 | public function getImage() |
|
136 | |||
137 | /** |
||
138 | * @return mixed |
||
139 | */ |
||
140 | public function Image() |
||
144 | |||
145 | /** |
||
146 | * @return FieldList |
||
147 | */ |
||
148 | 1 | public function getCMSFields() |
|
245 | |||
246 | /** |
||
247 | * @return CatalogCategory |
||
248 | */ |
||
249 | 2 | public function getPrimaryCategory() |
|
258 | |||
259 | /** |
||
260 | * @return string |
||
261 | */ |
||
262 | 1 | public function getParentPage() |
|
266 | |||
267 | /** |
||
268 | * @return string |
||
269 | */ |
||
270 | 1 | public function getViewAction() |
|
274 | |||
275 | /** |
||
276 | * needed for Blocks |
||
277 | * |
||
278 | * @return DataList |
||
279 | */ |
||
280 | public function getAncestors() |
||
285 | |||
286 | /** |
||
287 | * @return array |
||
288 | */ |
||
289 | 1 | public function providePermissions() |
|
297 | |||
298 | /** |
||
299 | * @param null $member |
||
300 | * |
||
301 | * @return bool|int |
||
302 | */ |
||
303 | 1 | public function canEdit($member = null) |
|
307 | |||
308 | /** |
||
309 | * @param null $member |
||
310 | * |
||
311 | * @return bool|int |
||
312 | */ |
||
313 | 1 | public function canDelete($member = null) |
|
317 | |||
318 | /** |
||
319 | * @param null $member |
||
320 | * |
||
321 | * @return bool|int |
||
322 | */ |
||
323 | 1 | public function canCreate($member = null) |
|
327 | |||
328 | /** |
||
329 | * @param null $member |
||
330 | * |
||
331 | * @return bool |
||
332 | */ |
||
333 | 1 | public function canView($member = null) |
|
337 | } |
If you implement
__call
and 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
__call
is implemented by a parent class and only the child class knows which methods exist: