1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Category\Ee\Observers\EeUrlKeyAndPathObserver |
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
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-category-ee |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Category\Ee\Observers; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Observer that extracts the URL key/path from the category path and |
25
|
|
|
* adds them as two new columns with the their values for Magento 2 EE. |
26
|
|
|
* |
27
|
|
|
* @author Tim Wagner <[email protected]> |
28
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
29
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
30
|
|
|
* @link https://github.com/techdivision/import-category-ee |
31
|
|
|
* @link http://www.techdivision.com |
32
|
|
|
*/ |
33
|
|
|
class EeUrlKeyAndPathObserver extends \TechDivision\Import\Category\Observers\UrlKeyAndPathObserver |
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The trait providing category import functionality. |
38
|
|
|
* |
39
|
|
|
* @var \TechDivision\Import\Category\Ee\Observers\EeCategoryObserverTrait |
40
|
|
|
*/ |
41
|
|
|
use EeCategoryObserverTrait; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Temporarily persist's the IDs of the passed category. |
45
|
|
|
* |
46
|
|
|
* @param array $category The category to temporarily persist the IDs for |
47
|
|
|
* |
48
|
|
|
* @return void |
49
|
|
|
*/ |
50
|
|
|
protected function setIds(array $category) |
51
|
|
|
{ |
52
|
|
|
$this->setLastRowId(isset($category[$this->getPkMemberName()]) ? $category[$this->getPkMemberName()] : null); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Return's the PK to of the product. |
57
|
|
|
* |
58
|
|
|
* @return integer The PK to create the relation with |
59
|
|
|
*/ |
60
|
|
|
protected function getPrimaryKey() |
61
|
|
|
{ |
62
|
|
|
return $this->getLastRowId(); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|