Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function __construct(ProductTaxonsMapperInterface $productTaxonsMapper, string $taxonsProperty) |
||
37 | { |
||
38 | $this->productTaxonsMapper = $productTaxonsMapper; |
||
39 | $this->taxonsProperty = $taxonsProperty; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param TransformEvent $event |
||
44 | */ |
||
45 | public function consumeEvent(TransformEvent $event): void |
||
46 | { |
||
47 | $this->buildProperty($event, ProductInterface::class, |
||
48 | function (ProductInterface $product, Document $document): void { |
||
49 | $taxons = $this->productTaxonsMapper->mapToUniqueCodes($product); |
||
50 | |||
51 | $document->set($this->taxonsProperty, $taxons); |
||
52 | } |
||
56 |