|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Product\Magic360\Observers\FileUploadObserver |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Tim Wagner <[email protected]> |
|
15
|
|
|
* @author Bernhard Wick <[email protected]> |
|
16
|
|
|
* @copyright 2017 TechDivision GmbH <[email protected]> |
|
17
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
18
|
|
|
* @link https://github.com/techdivision/import-product-magic360 |
|
19
|
|
|
* @link http://www.techdivision.com |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace TechDivision\Import\Product\Magic360\Observers; |
|
23
|
|
|
|
|
24
|
|
|
use TechDivision\Import\Product\Media\Utils\ColumnKeys; |
|
25
|
|
|
use TechDivision\Import\Observers\AbstractFileUploadObserver; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Observer that uploads the file specified in a CSV file's column 'image_path' to a |
|
29
|
|
|
* configurable directoy. |
|
30
|
|
|
* |
|
31
|
|
|
* @author Tim Wagner <[email protected]> |
|
32
|
|
|
* @author Bernhard Wick <[email protected]> |
|
33
|
|
|
* @copyright 2017 TechDivision GmbH <[email protected]> |
|
34
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
35
|
|
|
* @link https://github.com/techdivision/import-product-magic360 |
|
36
|
|
|
* @link http://www.techdivision.com |
|
37
|
|
|
*/ |
|
38
|
|
|
class FileUploadObserver extends AbstractFileUploadObserver |
|
39
|
|
|
{ |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Return's the name of the source column with the image path. |
|
43
|
|
|
* |
|
44
|
|
|
* @return string The image path |
|
45
|
|
|
*/ |
|
46
|
|
|
protected function getSourceColumn() |
|
47
|
|
|
{ |
|
48
|
|
|
return ColumnKeys::IMAGE_PATH; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Return's the target column with the path of the copied image. |
|
53
|
|
|
* |
|
54
|
|
|
* @return string The path to the copied image |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function getTargetColumn() |
|
57
|
|
|
{ |
|
58
|
|
|
return ColumnKeys::IMAGE_PATH_NEW; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|