src/Entity/Product.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\MainTranslationTrait;
  4. use App\Entity\Translation\ProductTranslation;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Translatable\Translatable;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. #[Gedmo\TranslationEntity(class: self::TRANSLATION_ENTITY)]
  12. #[ORM\Entity()]
  13. class Product implements Translatable
  14. {
  15.     use MainTranslationTrait;
  16.     const TRANSLATION_ENTITY ProductTranslation::class;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(type'string',nullabletrue)]
  22.     #[Gedmo\Translatable]
  23.     private ?string $title null;
  24.     #[ORM\Column(type'string',nullabletrue)]
  25.     private ?string $image null;
  26.     #[ORM\Column(type'string',nullabletrue)]
  27.     private ?string $minImage null;
  28.     #[ORM\Column(type'string',nullabletrue)]
  29.     private ?string $miniSecondImage null;
  30.     #[ORM\Column(type'text',nullabletrue)]
  31.     #[Gedmo\Translatable]
  32.     private mixed $productDescription null;
  33.     #[ORM\Column(type'string',nullabletrue)]
  34.     #[Gedmo\Translatable]
  35.     private mixed $type null;
  36.     #[ORM\Column(type'string',nullabletrue)]
  37.     #[Gedmo\Translatable]
  38.     private mixed $weight null;
  39.     #[ORM\Column(type'string',nullabletrue)]
  40.     #[Gedmo\Translatable]
  41.     private mixed $gold null;
  42.     #[ORM\Column(type'string',nullabletrue)]
  43.     #[Gedmo\Translatable]
  44.     private mixed $stone null;
  45.     #[ORM\Column(type'float',nullabletrue)]
  46.     private ?float $price null;
  47.     #[ORM\Column(type'string',nullabletrue)]
  48.     private ?string $refNumber null;
  49.     #[ORM\ManyToOne(inversedBy'products')]
  50.     #[ORM\JoinColumn(nullablefalse)]
  51.     private ?Category $category null;
  52.     #[ORM\ManyToOne(inversedBy'products')]
  53.     #[ORM\JoinColumn(nullablefalse)]
  54.     private \App\Entity\Collection|null $collection null;
  55.     #[ORM\ManyToMany(targetEntityTag::class)]
  56.     private Collection $tags;
  57.     public function __construct()
  58.     {
  59.         $this->tags = new ArrayCollection();
  60.     }
  61.     /**
  62.      * @return int|null
  63.      */
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     /**
  69.      * @param int|null $id
  70.      */
  71.     public function setId(?int $id): void
  72.     {
  73.         $this->id $id;
  74.     }
  75.     /**
  76.      * @return string|null
  77.      */
  78.     public function getTitle(): ?string
  79.     {
  80.         return $this->title;
  81.     }
  82.     /**
  83.      * @param string|null $title
  84.      */
  85.     public function setTitle(?string $title): void
  86.     {
  87.         $this->title $title;
  88.     }
  89.     /**
  90.      * @return string|null
  91.      */
  92.     public function getImage(): ?string
  93.     {
  94.         return $this->image;
  95.     }
  96.     /**
  97.      * @param string|null $image
  98.      */
  99.     public function setImage(?string $image): void
  100.     {
  101.         $this->image $image;
  102.     }
  103.     /**
  104.      * @return mixed|null
  105.      */
  106.     public function getProductDescription(): mixed
  107.     {
  108.         return $this->productDescription;
  109.     }
  110.     /**
  111.      * @param mixed|null $productDescription
  112.      */
  113.     public function setProductDescription(mixed $productDescription): void
  114.     {
  115.         $this->productDescription $productDescription;
  116.     }
  117.     public function getType(): ?string
  118.     {
  119.         return $this->type;
  120.     }
  121.     public function setType(?string $type): self
  122.     {
  123.         $this->type $type;
  124.         return $this;
  125.     }
  126.     public function getWeight(): ?string
  127.     {
  128.         return $this->weight;
  129.     }
  130.     public function setWeight(?string $weight): self
  131.     {
  132.         $this->weight $weight;
  133.         return $this;
  134.     }
  135.     public function getStone(): ?string
  136.     {
  137.         return $this->stone;
  138.     }
  139.     public function setStone(?string $stone): self
  140.     {
  141.         $this->stone $stone;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return float|null
  146.      */
  147.     public function getPrice(): ?float
  148.     {
  149.         return $this->price;
  150.     }
  151.     /**
  152.      * @param float|null $price
  153.      */
  154.     public function setPrice(?float $price): void
  155.     {
  156.         $this->price $price;
  157.     }
  158.     /**
  159.      * @return string|null
  160.      */
  161.     public function getRefNumber(): ?string
  162.     {
  163.         return $this->refNumber;
  164.     }
  165.     /**
  166.      * @param string|null $refNumber
  167.      */
  168.     public function setRefNumber(?string $refNumber): void
  169.     {
  170.         $this->refNumber $refNumber;
  171.     }
  172.     public function getCategory(): ?Category
  173.     {
  174.         return $this->category;
  175.     }
  176.     public function setCategory(?Category $category): self
  177.     {
  178.         $this->category $category;
  179.         return $this;
  180.     }
  181.     public function getCollection(): ?\App\Entity\Collection
  182.     {
  183.         return $this->collection;
  184.     }
  185.     public function setCollection(?\App\Entity\Collection $collection): self
  186.     {
  187.         $this->collection $collection;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection<int, Tag>
  192.      */
  193.     public function getTags(): Collection
  194.     {
  195.         return $this->tags;
  196.     }
  197.     public function addTag(Tag $tag): self
  198.     {
  199.         if (!$this->tags->contains($tag)) {
  200.             $this->tags->add($tag);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeTag(Tag $tag): self
  205.     {
  206.         $this->tags->removeElement($tag);
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return string|null
  211.      */
  212.     public function getMinImage(): ?string
  213.     {
  214.         return $this->minImage;
  215.     }
  216.     /**
  217.      * @param string|null $minImage
  218.      */
  219.     public function setMinImage(?string $minImage): void
  220.     {
  221.         $this->minImage $minImage;
  222.     }
  223.     /**
  224.      * @return string|null
  225.      */
  226.     public function getMiniSecondImage(): ?string
  227.     {
  228.         return $this->miniSecondImage;
  229.     }
  230.     /**
  231.      * @param string|null $miniSecondImage
  232.      */
  233.     public function setMiniSecondImage(?string $miniSecondImage): void
  234.     {
  235.         $this->miniSecondImage $miniSecondImage;
  236.     }
  237.     public function getGold(): ?string
  238.     {
  239.         return $this->gold;
  240.     }
  241.     public function setGold(?string $gold): static
  242.     {
  243.         $this->gold $gold;
  244.         return $this;
  245.     }
  246. }