Conditions | 3 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function consumeEvent(PostTransformEvent $event): void |
||
30 | { |
||
31 | $this->buildProperty( |
||
32 | $event, |
||
33 | ProductInterface::class, |
||
34 | function (ProductInterface $product, Document $document): void { |
||
35 | if (0 === $product->getVariants()->count()) { |
||
36 | return; |
||
37 | } |
||
38 | |||
39 | /** @var ProductVariantInterface $productVariant */ |
||
40 | $productVariant = $product->getVariants()->first(); |
||
41 | |||
42 | foreach ($productVariant->getChannelPricings() as $channelPricing) { |
||
43 | $propertyName = $this->channelPricingNameResolver->resolvePropertyName($channelPricing->getChannelCode()); |
||
44 | |||
45 | $document->set($propertyName, $channelPricing->getPrice()); |
||
46 | } |
||
51 |