1 <?php
2
3 /* --------------------------------------------------------------
4 ProductWriteServiceInterface.inc.php 2015-12-08
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 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 ProductWriteServiceInterface
15 *
16 * @category System
17 * @package Product
18 * @subpackage Interfaces
19 */
20 Interface ProductWriteServiceInterface
21 {
22 /**
23 * Create Product
24 *
25 * Creates a new product and returns the ID of it.
26 *
27 * @param ProductInterface $product The product to create.
28 *
29 * @return int The ID of the created product.
30 */
31 public function createProduct(ProductInterface $product);
32
33
34 /**
35 * Update Product
36 *
37 * Updates a stored product.
38 *
39 * @param StoredProductInterface $product The product to update.
40 *
41 * @return ProductWriteServiceInterface Same instance for chained method calls.
42 */
43 public function updateProduct(StoredProductInterface $product);
44
45
46 /**
47 * Delete Product
48 *
49 * Deletes a specific product, depending on the provided product ID.
50 *
51 * @param IdType $productId The product ID of the product to delete.
52 *
53 * @return ProductWriteServiceInterface Same instance for chained method calls.
54 */
55 public function deleteProductById(IdType $productId);
56
57
58 /**
59 * Duplicate Product
60 *
61 * Duplicates a product to a category.
62 *
63 * @param IdType $productId The product ID of the product to duplicate.
64 * @param IdType $targetCategoryId The target category ID of the product to be duplicated to.s
65 * @param BoolType $duplicateAttributes Should the attributes be duplicated also?
66 * @param BoolType $duplicateSpecials Should the specials be duplicated also?
67 * @param BoolType $duplicateCrossSelling Should cross selling be duplicated also?
68 *
69 * @return int Returns the ID of the new product.
70 */
71 public function duplicateProduct(IdType $productId,
72 IdType $targetCategoryId,
73 BoolType $duplicateAttributes,
74 BoolType $duplicateSpecials,
75 BoolType $duplicateCrossSelling);
76
77
78 /**
79 * Link Product
80 *
81 * Links a product to a category.
82 *
83 * @param IdType $productId The product ID of the product to link.
84 * @param IdType $targetCategoryId The target category ID, of the category to be linked to.
85 *
86 * @return ProductWriteServiceInterface Same instance for chained method calls.
87 */
88 public function linkProduct(IdType $productId, IdType $targetCategoryId);
89
90
91 /**
92 * Changes the category link of a product.
93 *
94 * @param IdType $productId The product ID of the product to move.
95 * @param IdType $currentCategoryId Old category ID of the product.
96 * @param IdType $newCategoryId New category ID of the product.
97 *
98 * @return ProductWriteServiceInterface Same instance for chained method calls.
99 */
100 public function changeProductLink(IdType $productId, IdType $currentCategoryId, IdType $newCategoryId);
101
102
103 /**
104 * Removes a category link from a product by the given product id.
105 *
106 * @param IdType $productId Id of the product.
107 * @param IdType $categoryId Id of category from where the product is link is to delete.
108 *
109 * @return ProductWriteServiceInterface Same instance for chained method calls.
110 */
111 public function deleteProductLink(IdType $productId, IdType $categoryId);
112
113
114 /**
115 * Removes all category links from a product by given product ID.
116 *
117 * @param IdType $productId ID of product.
118 *
119 * @return ProductWriteServiceInterface Same instance for chained method calls.
120 */
121 public function deleteProductLinks(IdType $productId);
122
123
124 /**
125 * Import Product Image File
126 *
127 * Imports an image for the product.
128 *
129 * @param ExistingFile $sourceFile The existing file to import.
130 * @param FilenameStringType $preferredFilename The preferred filename.
131 *
132 * @return string The new filename.
133 */
134 public function importProductImageFile(ExistingFile $sourceFile, FilenameStringType $preferredFilename);
135
136
137 /**
138 * Rename Product Image File
139 *
140 * Renames a product image file.
141 *
142 * @param FilenameStringType $oldName The old name of the product image file.
143 * @param FilenameStringType $newName The new name of the product image file.
144 *
145 * @return ProductWriteServiceInterface Same instance for chained method calls.
146 */
147 public function renameProductImage(FilenameStringType $oldName, FilenameStringType $newName);
148
149
150 /**
151 * Delete Product Image
152 *
153 * Deletes a product image.
154 *
155 * @param FilenameStringType $filename The filename of the product image to delete.
156 *
157 * @return ProductWriteServiceInterface Same instance for chained method calls.
158 */
159 public function deleteProductImage(FilenameStringType $filename);
160 }