1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Observers\GenericColumnCollectorObserver |
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 2021 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 |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Observers; |
22
|
|
|
|
23
|
|
|
use Ramsey\Uuid\Uuid; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Observer that loads the data of a set of configurable columns |
27
|
|
|
* into the registry for further processing, e. g. validation. |
28
|
|
|
* |
29
|
|
|
* As index the column name and a UUID will be used, whereas it |
30
|
|
|
* is not clear to which entity the collected data belongs. This |
31
|
|
|
* observer can therefore be used when only the collected data |
32
|
|
|
* is of interest, for example you want to have a list of SKUs |
33
|
|
|
* that are part of the import file. |
34
|
|
|
* |
35
|
|
|
* @author Tim Wagner <[email protected]> |
36
|
|
|
* @copyright 2021 TechDivision GmbH <[email protected]> |
37
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
38
|
|
|
* @link https://github.com/techdivision/import |
39
|
|
|
* @link http://www.techdivision.com |
40
|
|
|
*/ |
41
|
|
|
class GenericColumnCollectorObserver extends AbstractColumnCollectorObserver |
42
|
|
|
{ |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Return's the primary key value that will be used as second incdex. |
46
|
|
|
* |
47
|
|
|
* @return string The primary key to be used |
48
|
|
|
*/ |
49
|
|
|
protected function getPrimaryKey() : string |
50
|
|
|
{ |
51
|
|
|
return Uuid::uuid4()->toString(); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|