src/Model/Product/ProductSearch.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Model\Product;
  3. use App\Model\Compare\NumberCompare;
  4. use App\Model\ProductSpecificField\ProductSpecificField;
  5. use App\Model\SpecificField\SpecificField;
  6. use App\Model\SpecificFieldAwareTrait;
  7. use App\Model\SpecificFieldsAwareInterface;
  8. use App\Model\Traits\ImportableObjectTrait;
  9. use App\Model\Traits\TimestampableTrait;
  10. use App\V4\Model\IdSearchTrait;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. class ProductSearch implements SpecificFieldsAwareInterface
  15. {
  16.     public const SPECIFIC_FIELD_CLASS_NAME ProductSpecificField::class;
  17.     use TimestampableTrait;
  18.     use ImportableObjectTrait;
  19.     use IdSearchTrait;
  20.     use SpecificFieldAwareTrait;
  21.     /**
  22.      * @var array|null
  23.      *
  24.      * @Groups({"product:search"})
  25.      */
  26.     private $vat;
  27.     /**
  28.      * @var array|null
  29.      *
  30.      * @Groups({"product:search"})
  31.      */
  32.     private $unit;
  33.     /**
  34.      * @var array|null
  35.      *
  36.      * @Groups({"product:search"})
  37.      */
  38.     private $categories;
  39.     /**
  40.      * @var array|null
  41.      *
  42.      * @Groups({"product:search"})
  43.      */
  44.     private $warranty;
  45.     /**
  46.      * @var SpecificField[]|Collection
  47.      *
  48.      * @Groups({"product:search"})
  49.      */
  50.     private $specificFields;
  51.     /**
  52.      * @var string|null
  53.      *
  54.      * @Groups({"product:search"})
  55.      */
  56.     private $name;
  57.     /**
  58.      * @var string|null
  59.      *
  60.      * @Groups({"product:search"})
  61.      */
  62.     private $shortDescription;
  63.     /**
  64.      * @var string|null
  65.      *
  66.      * @Groups({"product:search"})
  67.      */
  68.     private $reference;
  69.     /**
  70.      * @var NumberCompare|null
  71.      *
  72.      * @Groups({"product:search"})
  73.      */
  74.     private $priceExcludingVat;
  75.     /**
  76.      * @var NumberCompare|null
  77.      *
  78.      * @Groups({"product:search"})
  79.      */
  80.     private $sellingPriceExcludingVat;
  81.     /**
  82.      * @var string|null
  83.      *
  84.      * @Groups({"product:search"})
  85.      */
  86.     private $serialNumber;
  87.     /**
  88.      * @var bool|null
  89.      *
  90.      * @Groups({"search"})
  91.      */
  92.     private $isComponent;
  93.     /**
  94.      * @var NumberCompare|null
  95.      *
  96.      * @Groups({"search"})
  97.      */
  98.     private $stockQty;
  99.     /**
  100.      * @var string|null
  101.      *
  102.      * @Groups({"product:search"})
  103.      */
  104.     private $fileLabel;
  105.     public function __construct()
  106.     {
  107.         $this->specificFields = new ArrayCollection();
  108.     }
  109.     /**
  110.      * @return array|null
  111.      */
  112.     public function getVat(): ?array
  113.     {
  114.         return $this->vat;
  115.     }
  116.     /**
  117.      * @param array|null $vat
  118.      *
  119.      * @return ProductSearch
  120.      */
  121.     public function setVat(?array $vat): ProductSearch
  122.     {
  123.         $this->vat $vat;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return array|null
  128.      */
  129.     public function getUnit(): ?array
  130.     {
  131.         return $this->unit;
  132.     }
  133.     /**
  134.      * @param array|null $unit
  135.      *
  136.      * @return ProductSearch
  137.      */
  138.     public function setUnit(?array $unit): ProductSearch
  139.     {
  140.         $this->unit $unit;
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return array|null
  145.      */
  146.     public function getCategories(): ?array
  147.     {
  148.         return $this->categories;
  149.     }
  150.     /**
  151.      * @param array|null $categories
  152.      *
  153.      * @return ProductSearch
  154.      */
  155.     public function setCategories(?array $categories): ProductSearch
  156.     {
  157.         $this->categories $categories;
  158.         return $this;
  159.     }
  160.     /**
  161.      * @return array|null
  162.      */
  163.     public function getWarranty(): ?array
  164.     {
  165.         return $this->warranty;
  166.     }
  167.     /**
  168.      * @param array|null $warranty
  169.      *
  170.      * @return ProductSearch
  171.      */
  172.     public function setWarranty(?array $warranty): ProductSearch
  173.     {
  174.         $this->warranty $warranty;
  175.         return $this;
  176.     }
  177.     /**
  178.      * {@inheritdoc}
  179.      */
  180.     public function getSpecificFields(): Collection
  181.     {
  182.         return $this->specificFields;
  183.     }
  184.     /**
  185.      * {@inheritdoc}
  186.      */
  187.     public function getSpecificFieldByFieldId(string $id): ?SpecificField
  188.     {
  189.         foreach ($this->specificFields as $specificField) {
  190.             if ($specificField->getFieldId() === $id) {
  191.                 return $specificField;
  192.             }
  193.         }
  194.         return null;
  195.     }
  196.     /**
  197.      * @see ImportableObjectTrait::class
  198.      *
  199.      * @param ProductSpecificField $specificField
  200.      *
  201.      * @return $this
  202.      */
  203.     public function addProductSpecificField(ProductSpecificField $specificField): self
  204.     {
  205.         return $this->addSpecificField($specificField);
  206.     }
  207.     /**
  208.      * {@inheritdoc}
  209.      */
  210.     public function addSpecificField($specificField): SpecificFieldsAwareInterface
  211.     {
  212.         $this->specificFields[] = $specificField;
  213.         return $this;
  214.     }
  215.     /**
  216.      * {@inheritdoc}
  217.      */
  218.     public function setSpecificFields(Collection $specificFields): self
  219.     {
  220.         $this->specificFields $specificFields;
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return string|null
  225.      */
  226.     public function getName(): ?string
  227.     {
  228.         return $this->name;
  229.     }
  230.     /**
  231.      * @param string|null $name
  232.      *
  233.      * @return ProductSearch
  234.      */
  235.     public function setName(?string $name): ProductSearch
  236.     {
  237.         $this->name $name;
  238.         return $this;
  239.     }
  240.     /**
  241.      * @return string|null
  242.      */
  243.     public function getShortDescription(): ?string
  244.     {
  245.         return $this->shortDescription;
  246.     }
  247.     /**
  248.      * @param string|null $shortDescription
  249.      *
  250.      * @return ProductSearch
  251.      */
  252.     public function setShortDescription(?string $shortDescription): ProductSearch
  253.     {
  254.         $this->shortDescription $shortDescription;
  255.         return $this;
  256.     }
  257.     /**
  258.      * @return string|null
  259.      */
  260.     public function getReference(): ?string
  261.     {
  262.         return $this->reference;
  263.     }
  264.     /**
  265.      * @param string|null $reference
  266.      *
  267.      * @return ProductSearch
  268.      */
  269.     public function setReference(?string $reference): ProductSearch
  270.     {
  271.         $this->reference $reference;
  272.         return $this;
  273.     }
  274.     /**
  275.      * @return NumberCompare|null
  276.      */
  277.     public function getPriceExcludingVat(): ?NumberCompare
  278.     {
  279.         return $this->priceExcludingVat;
  280.     }
  281.     /**
  282.      * @param NumberCompare|null $priceExcludingVat
  283.      *
  284.      * @return ProductSearch
  285.      */
  286.     public function setPriceExcludingVat(?NumberCompare $priceExcludingVat): ProductSearch
  287.     {
  288.         $this->priceExcludingVat $priceExcludingVat;
  289.         return $this;
  290.     }
  291.     /**
  292.      * @return NumberCompare|null
  293.      */
  294.     public function getSellingPriceExcludingVat(): ?NumberCompare
  295.     {
  296.         return $this->sellingPriceExcludingVat;
  297.     }
  298.     /**
  299.      * @param NumberCompare|null $sellingPriceExcludingVat
  300.      *
  301.      * @return ProductSearch
  302.      */
  303.     public function setSellingPriceExcludingVat(?NumberCompare $sellingPriceExcludingVat): ProductSearch
  304.     {
  305.         $this->sellingPriceExcludingVat $sellingPriceExcludingVat;
  306.         return $this;
  307.     }
  308.     /**
  309.      * @return string|null
  310.      */
  311.     public function getSerialNumber(): ?string
  312.     {
  313.         return $this->serialNumber;
  314.     }
  315.     /**
  316.      * @param string|null $serialNumber
  317.      *
  318.      * @return ProductSearch
  319.      */
  320.     public function setSerialNumber(?string $serialNumber): ProductSearch
  321.     {
  322.         $this->serialNumber $serialNumber;
  323.         return $this;
  324.     }
  325.     /**
  326.      * @return bool|null
  327.      */
  328.     public function getIsComponent(): ?bool
  329.     {
  330.         return $this->isComponent;
  331.     }
  332.     /**
  333.      * @param bool|null $isComponent
  334.      *
  335.      * @return ProductSearch
  336.      */
  337.     public function setIsComponent(?bool $isComponent): ProductSearch
  338.     {
  339.         $this->isComponent $isComponent;
  340.         return $this;
  341.     }
  342.     /**
  343.      * @return NumberCompare|null
  344.      */
  345.     public function getStockQty(): ?NumberCompare
  346.     {
  347.         return $this->stockQty;
  348.     }
  349.     /**
  350.      * @param NumberCompare|null $stockQty
  351.      *
  352.      * @return ProductSearch
  353.      */
  354.     public function setStockQty(?NumberCompare $stockQty): ProductSearch
  355.     {
  356.         $this->stockQty $stockQty;
  357.         return $this;
  358.     }
  359.     public function getFileLabel(): ?string
  360.     {
  361.         return $this->fileLabel;
  362.     }
  363.     public function setFileLabel(?string $fileLabel): self
  364.     {
  365.         $this->fileLabel $fileLabel;
  366.         return $this;
  367.     }
  368. }