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 $many_many = array( |
||
30 | 'Categories' => 'CatalogCategory', |
||
31 | 'CareCleaningDocs' => 'CareCleaningDoc', |
||
32 | 'OperationManuals' => 'OperationManual', |
||
33 | 'SpecSheets' => 'SpecSheet', |
||
34 | 'Warranties' => 'Warranty', |
||
35 | ); |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private static $many_many_extraFields = array( |
||
41 | 'Categories' => array( |
||
42 | 'SortOrder' => 'Int', |
||
43 | ), |
||
44 | 'CareCleaningDocs' => array( |
||
45 | 'Sort' => 'Int', |
||
46 | ), |
||
47 | 'OperationManuals' => array( |
||
48 | 'Sort' => 'Int', |
||
49 | ), |
||
50 | 'SpecSheets' => array( |
||
51 | 'Sort' => 'Int', |
||
52 | ), |
||
53 | 'Warranties' => array( |
||
54 | 'Sort' => 'Int', |
||
55 | ), |
||
56 | ); |
||
57 | |||
58 | /** |
||
59 | * @var array |
||
60 | */ |
||
61 | private static $summary_fields = array( |
||
62 | 'ProductThumbnail' => 'Image', |
||
63 | 'Title' => 'Title', |
||
64 | 'Type' => 'Type', |
||
65 | 'CategoryList' => 'Categories', |
||
66 | ); |
||
67 | |||
68 | /** |
||
69 | * @var array |
||
70 | */ |
||
71 | private static $searchable_fields = array( |
||
72 | 'Title' => array( |
||
73 | 'title' => 'Product Name', |
||
74 | ), |
||
75 | 'Categories.ID' => array( |
||
76 | 'title' => 'Category', |
||
77 | ), |
||
78 | ); |
||
79 | |||
80 | /** |
||
81 | * @var array |
||
82 | */ |
||
83 | private static $extensions = [ |
||
84 | 'VersionedDataObject', |
||
85 | ]; |
||
86 | |||
87 | /** |
||
88 | * @param bool $includerelations |
||
89 | * @return array|string |
||
90 | */ |
||
91 | 2 | public function fieldLabels($includerelations = true) |
|
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | 1 | public function CategoryList() |
|
119 | |||
120 | /** |
||
121 | * @return mixed |
||
122 | */ |
||
123 | 1 | public function getImage() |
|
129 | |||
130 | /** |
||
131 | * @return mixed |
||
132 | */ |
||
133 | public function Image() |
||
137 | |||
138 | /** |
||
139 | * @return mixed |
||
140 | */ |
||
141 | public function ProductThumbnail() |
||
147 | |||
148 | /** |
||
149 | * @return FieldList |
||
150 | */ |
||
151 | 1 | public function getCMSFields() |
|
237 | |||
238 | /** |
||
239 | * @return CatalogCategory |
||
240 | */ |
||
241 | 2 | public function getPrimaryCategory() |
|
250 | |||
251 | /** |
||
252 | * set ParentPage for ViewableDataobject |
||
253 | * |
||
254 | * @return string |
||
255 | */ |
||
256 | 1 | public function getParentPage() |
|
260 | |||
261 | /** |
||
262 | * set ViewAction for ViewableDataobject |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | 1 | public function getViewAction() |
|
270 | |||
271 | /** |
||
272 | * set Ancestors, needed for Blocks on Dataobjects |
||
273 | * |
||
274 | * @return DataList |
||
275 | */ |
||
276 | public function getAncestors() |
||
280 | |||
281 | /** |
||
282 | * @return array |
||
283 | */ |
||
284 | 1 | public function providePermissions() |
|
292 | |||
293 | /** |
||
294 | * @param null $member |
||
295 | * |
||
296 | * @return bool|int |
||
297 | */ |
||
298 | 1 | public function canEdit($member = null) |
|
302 | |||
303 | /** |
||
304 | * @param null $member |
||
305 | * |
||
306 | * @return bool|int |
||
307 | */ |
||
308 | 1 | public function canDelete($member = null) |
|
312 | |||
313 | /** |
||
314 | * @param null $member |
||
315 | * |
||
316 | * @return bool|int |
||
317 | */ |
||
318 | 1 | public function canCreate($member = null) |
|
322 | |||
323 | /** |
||
324 | * @param null $member |
||
325 | * |
||
326 | * @return bool |
||
327 | */ |
||
328 | 1 | public function canView($member = null) |
|
332 | } |
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: