1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Magic360\Observers\Magic360ColumnsUpdateObserver |
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\Magic360\Utils\MemberNames; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Observer that creates/updates the magic360 columns information. |
28
|
|
|
* |
29
|
|
|
* @author Tim Wagner <[email protected]> |
30
|
|
|
* @author Bernhard Wick <[email protected]> |
31
|
|
|
* @copyright 2017 TechDivision GmbH <[email protected]> |
32
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
33
|
|
|
* @link https://github.com/techdivision/import-product-magic360 |
34
|
|
|
* @link http://www.techdivision.com |
35
|
|
|
*/ |
36
|
|
|
class Magic360ColumnsUpdateObserver extends Magic360ColumnsObserver |
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Initialize the magic360 column with the passed attributes and returns an instance. |
41
|
|
|
* |
42
|
|
|
* @param array $attr The product media gallery value attributes |
43
|
|
|
* |
44
|
|
|
* @return array The initialized product media gallery value |
45
|
|
|
*/ |
46
|
|
|
protected function initializeMagic360Columns(array $attr) |
47
|
|
|
{ |
48
|
|
|
// query whether the product media gallery value already exists or not |
49
|
|
|
if ($entity = $this->getSubject()->loadMagic360Columns($attr[MemberNames::PRODUCT_ID])) { |
50
|
|
|
return $this->mergeEntity($entity, $attr); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
// simply return the attributes |
54
|
|
|
return $attr; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|