vendor/bitbag/elasticsearch-plugin/src/Context/ProductAttributesContext.php line 35

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file has been created by developers from BitBag.
  4.  * Feel free to contact us once you face any issues or want to start
  5.  * another great project.
  6.  * You can find more information about us on https://bitbag.io and write us
  7.  * an email on hello@bitbag.io.
  8.  */
  9. declare(strict_types=1);
  10. namespace BitBag\SyliusElasticsearchPlugin\Context;
  11. use BitBag\SyliusElasticsearchPlugin\Finder\ProductAttributesFinderInterface;
  12. final class ProductAttributesContext implements ProductAttributesContextInterface
  13. {
  14.     private TaxonContextInterface $taxonContext;
  15.     private ProductAttributesFinderInterface $attributesFinder;
  16.     public function __construct(
  17.         TaxonContextInterface $taxonContext,
  18.         ProductAttributesFinderInterface $attributesFinder
  19.     ) {
  20.         $this->taxonContext $taxonContext;
  21.         $this->attributesFinder $attributesFinder;
  22.     }
  23.     public function getAttributes(): ?array
  24.     {
  25.         $taxon $this->taxonContext->getTaxon();
  26.         return $this->attributesFinder->findByTaxon($taxon);
  27.     }
  28. }