1 | <?php |
||
39 | class ProductMagic360Processor implements ProductMagic360ProcessorInterface |
||
40 | { |
||
41 | |||
42 | /** |
||
43 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
44 | * |
||
45 | * @var \PDO |
||
46 | */ |
||
47 | protected $connection; |
||
48 | |||
49 | /** |
||
50 | * The repository to load magic360 galleries. |
||
51 | * |
||
52 | * @var \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360GalleryRepository |
||
53 | */ |
||
54 | protected $productMagic360GalleryRepository; |
||
55 | |||
56 | /** |
||
57 | * The repository to load magic360 gallery to entities. |
||
58 | * |
||
59 | * @var \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360ColumnsRepository |
||
60 | */ |
||
61 | protected $productMagic360ColumnsRepository; |
||
62 | |||
63 | /** |
||
64 | * The action with the magic360 gallery CRUD methods. |
||
65 | * |
||
66 | * @var \TechDivision\Import\Product\Magic360\Actions\Magic360GalleryAction |
||
67 | */ |
||
68 | protected $magic360GalleryAction; |
||
69 | |||
70 | /** |
||
71 | * The action with the magic360 gallery value CRUD methods. |
||
72 | * |
||
73 | * @var \TechDivision\Import\Product\Magic360\Actions\Magic360ColumnsAction |
||
74 | */ |
||
75 | protected $magic360ColumnsAction; |
||
76 | |||
77 | /** |
||
78 | * Initialize the processor with the necessary assembler and repository instances. |
||
79 | * |
||
80 | * @param \PDO $connection The PDO connection to use |
||
81 | * @param \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360GalleryRepository $productMagic360GalleryRepository The product magic 360 gallery repository to use |
||
82 | * @param \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360ColumnsRepository $productMagic360ColumnsRepository The product magic 360 columns repository to use |
||
83 | * @param \TechDivision\Import\Product\Magic360\Actions\Magic360GalleryAction $magic360GalleryAction The product magic 360 gallery action to use |
||
84 | * @param \TechDivision\Import\Product\Magic360\Actions\Magic360ColumnsAction $magic360ColumnsAction The product magic 360 columns action to use |
||
85 | */ |
||
86 | public function __construct( |
||
99 | |||
100 | /** |
||
101 | * Sets the passed connection. |
||
102 | * |
||
103 | * @param \PDO $connection The connection to set |
||
104 | * |
||
105 | * @return void |
||
106 | */ |
||
107 | public function setConnection(\PDO $connection) |
||
111 | |||
112 | /** |
||
113 | * Returns the connection. |
||
114 | * |
||
115 | * @return \PDO The connection instance |
||
116 | */ |
||
117 | public function getConnection() |
||
121 | |||
122 | /** |
||
123 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
124 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
125 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
126 | * to autocommit mode. |
||
127 | * |
||
128 | * @return boolean Returns TRUE on success or FALSE on failure |
||
129 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
130 | */ |
||
131 | public function beginTransaction() |
||
135 | |||
136 | /** |
||
137 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
138 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
139 | * |
||
140 | * @return boolean Returns TRUE on success or FALSE on failure |
||
141 | * @link http://php.net/manual/en/pdo.commit.php |
||
142 | */ |
||
143 | public function commit() |
||
147 | |||
148 | /** |
||
149 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
150 | * |
||
151 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
152 | * rolled back the transaction. |
||
153 | * |
||
154 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
155 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
156 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
157 | * |
||
158 | * @return boolean Returns TRUE on success or FALSE on failure |
||
159 | * @link http://php.net/manual/en/pdo.rollback.php |
||
160 | */ |
||
161 | public function rollBack() |
||
165 | |||
166 | /** |
||
167 | * Sets the repository to load magic360 gallery data. |
||
168 | * |
||
169 | * @param \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360GalleryRepository $productMagic360GalleryRepository The repository instance |
||
170 | * |
||
171 | * @return void |
||
172 | */ |
||
173 | public function setProductMagic360GalleryRepository($productMagic360GalleryRepository) |
||
177 | |||
178 | /** |
||
179 | * Returns the repository to load magic360 gallery data. |
||
180 | * |
||
181 | * @return \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360GalleryRepository The repository instance |
||
182 | */ |
||
183 | public function getProductMagic360GalleryRepository() |
||
187 | |||
188 | /** |
||
189 | * Sets the repository to load magic360 column data. |
||
190 | * |
||
191 | * @param \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360ColumnsRepository $productMagic360ColumnsRepository The repository instance |
||
192 | * |
||
193 | * @return void |
||
194 | */ |
||
195 | public function setProductMagic360ColumnsRepository($productMagic360ColumnsRepository) |
||
199 | |||
200 | /** |
||
201 | * Returns the repository to load magic360 column data. |
||
202 | * |
||
203 | * @return \TechDivision\Import\Product\Magic360\Repositories\ProductMagic360ColumnsRepository The repository instance |
||
204 | */ |
||
205 | public function getProductMagic360ColumnsRepository() |
||
209 | |||
210 | /** |
||
211 | * Sets the action with the magic360 gallery CRUD methods. |
||
212 | * |
||
213 | * @param \TechDivision\Import\Product\Magic360\Actions\Magic360GalleryAction $magic360GalleryAction The action with the magic360 gallery CRUD methods |
||
214 | * |
||
215 | * @return void |
||
216 | */ |
||
217 | public function setMagic360GalleryAction($magic360GalleryAction) |
||
221 | |||
222 | /** |
||
223 | * Returns the action with the magic360 gallery CRUD methods. |
||
224 | * |
||
225 | * @return \TechDivision\Import\Product\Magic360\Actions\Magic360GalleryAction $magic360GalleryAction The action with the magic360 gallery CRUD methods |
||
226 | */ |
||
227 | public function getMagic360GalleryAction() |
||
231 | |||
232 | /** |
||
233 | * Sets the action with the magic360 column CRUD methods. |
||
234 | * |
||
235 | * @param \TechDivision\Import\Product\Magic360\Actions\Magic360ColumnsAction $magic360ColumnsAction The action with the magic360 column CRUD methods |
||
236 | * |
||
237 | * @return void |
||
238 | */ |
||
239 | public function setMagic360ColumnsAction($magic360ColumnsAction) |
||
243 | |||
244 | /** |
||
245 | * Returns the action with the magic360 column CRUD methods. |
||
246 | * |
||
247 | * @return \TechDivision\Import\Product\Magic360\Actions\Magic360ColumnsAction The action with the magic360 column CRUD methods |
||
248 | */ |
||
249 | public function getMagic360ColumnsAction() |
||
253 | |||
254 | /** |
||
255 | * Persists the passed magic360 gallery data and returns the ID. |
||
256 | * |
||
257 | * @param array $galleryEntry The magic360 gallery data to persist |
||
258 | * @param string|null $name The name of the prepared statement that has to be executed |
||
259 | * |
||
260 | * @return string The ID of the persisted entity |
||
261 | */ |
||
262 | public function persistMagic360Gallery($galleryEntry, $name = null) |
||
266 | |||
267 | /** |
||
268 | * Persists the passed magic360 column data. |
||
269 | * |
||
270 | * @param array $magic360Columns The magic360 gallery value data to persist |
||
271 | * @param string|null $name The name of the prepared statement that has to be executed |
||
272 | * |
||
273 | * @return void |
||
274 | */ |
||
275 | public function persistMagic360Columns($magic360Columns, $name = null) |
||
279 | |||
280 | /** |
||
281 | * Persists the passed magic360 gallery data and returns the ID. |
||
282 | * |
||
283 | * @param array $row The magic360 gallery data to persist |
||
284 | * @param string|null $name The name of the prepared statement that has to be executed |
||
285 | * |
||
286 | * @return void |
||
287 | */ |
||
288 | public function deleteMagic360Gallery($row, $name = null) |
||
292 | |||
293 | /** |
||
294 | * Persists the passed magic360 column data. |
||
295 | * |
||
296 | * @param array $row The magic360 column data to persist |
||
297 | * @param string|null $name The name of the prepared statement that has to be executed |
||
298 | * |
||
299 | * @return void |
||
300 | */ |
||
301 | public function deleteMagic360Columns($row, $name = null) |
||
305 | |||
306 | /** |
||
307 | * Loads the magic360 gallery with the passed product ID and position |
||
308 | * |
||
309 | * @param integer $productId The product ID of the magic360 gallery to load |
||
310 | * @param string $position The position of the magic360 gallery entry to load |
||
311 | * |
||
312 | * @return array The magic360 gallery |
||
313 | */ |
||
314 | public function loadMagic360Gallery($productId, $position) |
||
318 | |||
319 | /** |
||
320 | * Loads the magic360 gallery with the passed product ID. |
||
321 | * |
||
322 | * @param integer $productId The product ID of the magic360 column to load |
||
323 | * |
||
324 | * @return array The magic360 gallery |
||
325 | */ |
||
326 | public function loadMagic360Columns($productId) |
||
330 | } |
||
331 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.