1 <?php
2
3 /* --------------------------------------------------------------
4 CategoryWriteServiceInterface.inc.php 2016-02-15
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2016 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 /**
14 * Interface CategoryWriteServiceInterface
15 *
16 * This interface defines methods for creating, updating and deleting categories data.
17 *
18 * @category System
19 * @package Category
20 * @subpackage Interfaces
21 */
22 interface CategoryWriteServiceInterface
23 {
24 /**
25 * Creates a category and returns the ID of it.
26 *
27 * @param CategoryInterface $category The category to create.
28 *
29 * @return int Returns the ID of the new category record.
30 */
31 public function createCategory(CategoryInterface $category);
32
33
34 /**
35 * Updates the provided category and returns itself.
36 *
37 * @param StoredCategoryInterface $category The category to update.
38 *
39 * @return CategoryWriteServiceInterface Same instance for chained method calls.
40 */
41 public function updateCategory(StoredCategoryInterface $category);
42
43
44 /**
45 * Deletes a category depending on the provided category ID.
46 *
47 * @param IdType $categoryId Category ID of the category to delete.
48 *
49 * @return CategoryWriteServiceInterface Same instance for chained method calls.
50 */
51 public function deleteCategoryById(IdType $categoryId);
52
53
54 /**
55 * Moves a category into another category.
56 *
57 * This method moves a category specified by its category ID into another parent category specified by its
58 * category ID.
59 *
60 * @param IdType $categoryId Category ID of the category to move.
61 * @param IdType $newParentId The new parent ID.
62 *
63 * @return CategoryWriteServiceInterface Same instance for chained method calls.
64 */
65 public function moveCategory(IdType $categoryId, IdType $newParentId);
66
67
68 /**
69 * Duplicates a category specified by its category ID.
70 *
71 * This method duplicates the category which are identified by the provided category ID and links the duplicated
72 * category with the provided parent category ID. Containing subcategories and products will also be recursively
73 * duplicated with their attributes, specials and cross selling data depending on the last four arguments.
74 *
75 * @param IdType $categoryId The category ID of the category to duplicate.
76 * @param IdType $targetParentId The target parent ID of the duplicated category.
77 * @param BoolType $duplicateProducts Should the products be duplicated?
78 * @param BoolType $duplicateAttributes Should the attributes be duplicated?
79 * @param BoolType $duplicateSpecials Should the specials be duplicated?
80 * @param BoolType $duplicateCrossSelling Should cross selling be duplicated?
81 *
82 * @return int Returns the ID of the new category record.
83 */
84 public function duplicateCategory(IdType $categoryId,
85 IdType $targetParentId,
86 BoolType $duplicateProducts,
87 BoolType $duplicateAttributes,
88 BoolType $duplicateSpecials,
89 BoolType $duplicateCrossSelling);
90
91
92 /**
93 * Imports an image file and stores it.
94 *
95 * @param ExistingFile $sourceFile The image file to import.
96 * @param FilenameStringType $saveAsFilename The name under which the image should to be stored.
97 *
98 * @return string The new filename.
99 */
100 public function importCategoryImageFile(ExistingFile $sourceFile, FilenameStringType $saveAsFilename);
101
102
103 /**
104 * Imports an icon file and stores it.
105 *
106 * @param ExistingFile $sourceFile The icon file to import.
107 * @param FilenameStringType $saveAsFilename The name under which the icon should be stored.
108 *
109 * @return string The new filename.
110 */
111 public function importCategoryIconFile(ExistingFile $sourceFile, FilenameStringType $saveAsFilename);
112
113
114 /**
115 * Renames a category image file.
116 *
117 * @param FilenameStringType $oldName Old filename.
118 * @param FilenameStringType $newName New filename.
119 *
120 * @return CategoryWriteServiceInterface Same instance for chained method calls.
121 */
122 public function renameCategoryImageFile(FilenameStringType $oldName, FilenameStringType $newName);
123
124
125 /**
126 * Renames a category icon file.
127 *
128 * @param FilenameStringType $oldName Old filename.
129 * @param FilenameStringType $newName New filename.
130 *
131 * @return CategoryWriteServiceInterface Same instance for chained method calls.
132 */
133 public function renameCategoryIconFile(FilenameStringType $oldName, FilenameStringType $newName);
134
135
136 /**
137 * Deletes a category image file.
138 *
139 * @param FilenameStringType $filename Category image filename.
140 *
141 * @return CategoryWriteServiceInterface Same instance for chained method calls.
142 */
143 public function deleteCategoryImageFile(FilenameStringType $filename);
144
145
146 /**
147 * Deletes a category icon file.
148 *
149 * @param FilenameStringType $filename Category icon filename.
150 *
151 * @return CategoryWriteServiceInterface Same instance for chained method calls.
152 */
153 public function deleteCategoryIconFile(FilenameStringType $filename);
154
155
156 /**
157 * Activates a specific category and its subcategories if desired.
158 *
159 * @param IdType $categoryId Category ID of the category to activate.
160 * @param BoolType $includeSubcategories Shall the subcategories be activated also?
161 *
162 * @return CategoryWriteServiceInterface Same instance for chained method calls.
163 */
164 public function activateCategory(IdType $categoryId, BoolType $includeSubcategories);
165
166
167 /**
168 * Deactivates a specific category and its subcategories if desired.
169 *
170 * @param \IdType $categoryId Category ID of the category to deactivate.
171 * @param \BoolType $includeSubcategories Shall the subcategories be deactivated also?
172 *
173 * @return CategoryWriteServiceInterface Same instance for chained method calls.
174 */
175 public function deactivateCategory(IdType $categoryId, BoolType $includeSubcategories);
176
177
178 /**
179 * Sets the customer status permissions.
180 *
181 * The customer status permissions decides if the category is visible for a specific customer group. The
182 * permissions can be applied for subcategories also if desired.
183 *
184 * @param \IdType $categoryId Category ID.
185 * @param \IdType $customerStatusId Customer status ID.
186 * @param \BoolType $permitted Grant permission?
187 * @param \BoolType $includeSubcategoriesAndProducts Grant permission including subcategories?
188 *
189 * @return CategoryWriteServiceInterface Same instance for chained method calls.
190 */
191 public function setCustomerStatusPermission(IdType $categoryId,
192 IdType $customerStatusId,
193 BoolType $permitted,
194 BoolType $includeSubcategoriesAndProducts);
195 }