1 | <?php |
||
11 | class DMSDocumentCartExtension extends DataExtension |
||
|
|||
12 | { |
||
13 | /** |
||
14 | * @var DMSDocumentCartController |
||
15 | */ |
||
16 | private $cartController; |
||
17 | |||
18 | private static $db = array( |
||
19 | 'AllowedInCart' => 'Boolean', |
||
20 | // Running total of print requests on this document |
||
21 | 'PrintRequestCount' => 'Int', |
||
22 | ); |
||
23 | |||
24 | /** |
||
25 | * Returns if a Document is permitted to reflect in a cart |
||
26 | * |
||
27 | * @return boolean |
||
28 | */ |
||
29 | public function isAllowedInCart() |
||
33 | |||
34 | public function updateCMSFields(FieldList $fields) |
||
41 | |||
42 | /** |
||
43 | * Increments the number of times a document was printed |
||
44 | * |
||
45 | * @return DMSDocument |
||
46 | */ |
||
47 | public function incrementPrintRequest() |
||
54 | |||
55 | /** |
||
56 | * Checks if a given document already exists within the Cart. True if it does, false otherwise |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function isInCart() |
||
64 | |||
65 | /** |
||
66 | * Checks to see if this extension (DMSDocumentCartExtension) has been loaded. |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function HasCartExtension() |
||
74 | |||
75 | /** |
||
76 | * Builds and returns a valid DMSDocumentController URL from the given $action link |
||
77 | * |
||
78 | * @param string $action Can be either 'add', 'remove' or 'checkout |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getActionLink($action = 'add') |
||
98 | |||
99 | /** |
||
100 | * Retrieves a DMSDocumentCartController handle |
||
101 | * |
||
102 | * @return DMSDocumentCartController |
||
103 | */ |
||
104 | public function getCartController() |
||
112 | |||
113 | /** |
||
114 | * Retrieves a DMSDocumentCart handle |
||
115 | * |
||
116 | * @return DMSDocumentCart |
||
117 | */ |
||
118 | public function getCart() |
||
122 | } |
||
123 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.