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) |
||
44 | |||
45 | /** |
||
46 | * Increments the number of times a document was printed |
||
47 | * |
||
48 | * @return DMSDocument |
||
49 | */ |
||
50 | public function incrementPrintRequest() |
||
57 | |||
58 | /** |
||
59 | * Checks if a given document already exists within the Cart. True if it does, false otherwise |
||
60 | * |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function isInCart() |
||
67 | |||
68 | /** |
||
69 | * Builds and returns a valid DMSDocumentController URL from the given $action link |
||
70 | * |
||
71 | * @param string $action Can be either 'add', 'remove' or 'checkout |
||
72 | * |
||
73 | * @return string |
||
74 | * |
||
75 | * @throws InvalidArgumentException if the provided $action is not allowed. |
||
76 | */ |
||
77 | public function getActionLink($action = 'add') |
||
93 | |||
94 | /** |
||
95 | * Retrieves a DMSDocumentCartController handle |
||
96 | * |
||
97 | * @return DMSDocumentCartController |
||
98 | */ |
||
99 | public function getCartController() |
||
107 | |||
108 | /** |
||
109 | * Retrieves a DMSDocumentCart handle |
||
110 | * |
||
111 | * @return DMSDocumentCart |
||
112 | */ |
||
113 | public function getCart() |
||
117 | } |
||
118 |
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.