|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Translator\Dictionary; |
|
9
|
|
|
|
|
10
|
|
|
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\AkeneoPimMiddlewareConnectorConfig; |
|
11
|
|
|
use SprykerMiddleware\Zed\Process\Business\Translator\Dictionary\AbstractDictionary; |
|
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class DefaultCategoryImportDictionary extends AbstractDictionary |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var array |
|
17
|
|
|
*/ |
|
18
|
|
|
protected static $localeMap; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\AkeneoPimMiddlewareConnectorConfig |
|
22
|
|
|
*/ |
|
23
|
|
|
private $config; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\AkeneoPimMiddlewareConnectorConfig $config |
|
27
|
|
|
*/ |
|
28
|
|
|
public function __construct(AkeneoPimMiddlewareConnectorConfig $config) |
|
29
|
|
|
{ |
|
30
|
|
|
$this->config = $config; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @return array |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getDictionary(): array |
|
37
|
|
|
{ |
|
38
|
|
|
return [ |
|
39
|
|
|
'localizedAttributes' => [ |
|
40
|
|
|
[ |
|
41
|
|
|
'LabelsToLocalizedAttributeNames', |
|
42
|
|
|
'options' => [ |
|
43
|
|
|
'defaultLocales' => $this->config->getLocalesForImport(), |
|
44
|
|
|
], |
|
45
|
|
|
], |
|
46
|
|
|
[ |
|
47
|
|
|
'LocaleKeysToIds', |
|
48
|
|
|
'options' => [ |
|
49
|
|
|
'map' => $this->getLocaleMap(), |
|
50
|
|
|
], |
|
51
|
|
|
], |
|
52
|
|
|
], |
|
53
|
|
|
'locales' => [ |
|
54
|
|
|
[ |
|
55
|
|
|
'LabelsToLocaleIds', |
|
56
|
|
|
'options' => [ |
|
57
|
|
|
'map' => $this->getLocaleMap(), |
|
58
|
|
|
], |
|
59
|
|
|
], |
|
60
|
|
|
], |
|
61
|
|
|
'fk_category_template' => function ($value, $payload) { |
|
|
|
|
|
|
62
|
|
|
return $this->config->getFkCategoryTemplate(); |
|
63
|
|
|
}, |
|
64
|
|
|
'parent_category_key' => function ($value) { |
|
65
|
|
|
if (!$value) { |
|
66
|
|
|
return $this->config->getDefaultParentCategoryKey(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return $value; |
|
70
|
|
|
}, |
|
71
|
|
|
]; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return array |
|
76
|
|
|
*/ |
|
77
|
|
|
protected function getLocaleMap(): array |
|
78
|
|
|
{ |
|
79
|
|
|
if (static::$localeMap === null) { |
|
|
|
|
|
|
80
|
|
|
$content = file_get_contents($this->config->getLocaleMapFilePath()); |
|
81
|
|
|
|
|
82
|
|
|
static::$localeMap = array_intersect_key(json_decode($content, true), array_flip($this->config->getLocalesForImport())); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
return static::$localeMap; |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths