1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\FactFinderSdk\Business\Expander; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CurrencyTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\LocaleTransfer; |
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\StoreTransfer; |
|
|
|
|
13
|
|
|
use Orm\Zed\PriceProduct\Persistence\Base\SpyPriceProduct; |
|
|
|
|
14
|
|
|
use SprykerEco\Shared\FactFinderSdk\FactFinderSdkConstants; |
15
|
|
|
|
16
|
|
|
class FactFinderSdkPriceExpander extends FactFinderSdkAbstractExpander |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer |
20
|
|
|
* @param \Generated\Shared\Transfer\CurrencyTransfer $currencyTransfer |
21
|
|
|
* @param \Generated\Shared\Transfer\StoreTransfer $storeTransfer |
22
|
|
|
* @param array $productData |
23
|
|
|
* |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
|
|
public function expand(LocaleTransfer $localeTransfer, CurrencyTransfer $currencyTransfer, StoreTransfer $storeTransfer, $productData) |
27
|
|
|
{ |
28
|
|
|
$priceProductQuery = $this->queryContainer |
29
|
|
|
->getPricesQuery($productData[FactFinderSdkConstants::ITEM_PRODUCT_NUMBER], $currencyTransfer, $storeTransfer); |
30
|
|
|
$price = $priceProductQuery->findOne(); |
31
|
|
|
|
32
|
|
|
if ($price !== null) { |
33
|
|
|
return $this->addPrice($productData, $price); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
$priceProductQuery = $this->queryContainer |
37
|
|
|
->getProductAbstractPriceQuery($productData[FactFinderSdkConstants::ITEM_PRODUCT_NUMBER], $currencyTransfer, $storeTransfer); |
38
|
|
|
$price = $priceProductQuery->findOne(); |
39
|
|
|
|
40
|
|
|
if ($price !== null) { |
41
|
|
|
return $this->addPrice($productData, $price); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return $productData; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param \Orm\Zed\PriceProduct\Persistence\Base\SpyPriceProduct $price |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
protected function getPrice(SpyPriceProduct $price) |
53
|
|
|
{ |
54
|
|
|
$priceValue = $price->getVirtualColumn(FactFinderSdkConstants::ITEM_PRICE); |
55
|
|
|
|
56
|
|
|
return number_format($priceValue / 100, 2, '.', ''); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param array $productData |
61
|
|
|
* @param \Orm\Zed\PriceProduct\Persistence\Base\SpyPriceProduct $price |
62
|
|
|
* |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
protected function addPrice($productData, SpyPriceProduct $price) |
66
|
|
|
{ |
67
|
|
|
$productData[FactFinderSdkConstants::ITEM_PRICE] = $this->getPrice($price); |
68
|
|
|
|
69
|
|
|
return $productData; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
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