src/Model/Product/ProductSearch.php line 16

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