src/Entity/Product.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\Wishlist;
  8. use App\Entity\ProductWishlist;
  9. /**
  10. * @ORM\Entity(repositoryClass=ProductRepository::class)
  11. */
  12. class Product
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\GeneratedValue
  17. * @ORM\Column(type="integer")
  18. */
  19. private $id;
  20. /**
  21. * @ORM\OneToMany(targetEntity=ProductWishlist::class, mappedBy="product")
  22. */
  23. private $productWishlists;
  24. /**
  25. * @ORM\Column(type="string", length=255)
  26. */
  27. private $name;
  28. /**
  29. * @ORM\Column(type="string", length=255)
  30. */
  31. private $slug;
  32. /**
  33. * @ORM\Column(type="string", length=255)
  34. */
  35. private $illustration;
  36. /**
  37. * @ORM\Column(type="string", length=255)
  38. */
  39. private $subtitle;
  40. /**
  41. * @ORM\Column(type="text")
  42. */
  43. private $description;
  44. /**
  45. * @ORM\Column(type="float")
  46. */
  47. private $price;
  48. /**
  49. * @ORM\ManyToOne(targetEntity=Category::class)
  50. * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
  51. */
  52. private $category;
  53. public function __construct()
  54. {
  55. $this->productWishlists = new ArrayCollection();
  56. }
  57. public function getId(): ?int
  58. {
  59. return $this->id;
  60. }
  61. public function getName(): ?string
  62. {
  63. return $this->name;
  64. }
  65. public function setName(string $name): self
  66. {
  67. $this->name = $name;
  68. return $this;
  69. }
  70. public function getSlug(): ?string
  71. {
  72. return $this->slug;
  73. }
  74. public function setSlug(string $slug): self
  75. {
  76. $this->slug = $slug;
  77. return $this;
  78. }
  79. public function getIllustration(): ?string
  80. {
  81. return $this->illustration;
  82. }
  83. public function setIllustration(string $illustration): self
  84. {
  85. $this->illustration = $illustration;
  86. return $this;
  87. }
  88. public function getSubtitle(): ?string
  89. {
  90. return $this->subtitle;
  91. }
  92. public function setSubtitle(string $subtitle): self
  93. {
  94. $this->subtitle = $subtitle;
  95. return $this;
  96. }
  97. public function getDescription(): ?string
  98. {
  99. return $this->description;
  100. }
  101. public function setDescription(string $description): self
  102. {
  103. $this->description = $description;
  104. return $this;
  105. }
  106. public function getPrice(): ?float
  107. {
  108. return $this->price;
  109. }
  110. public function setPrice(float $price): self
  111. {
  112. $this->price = $price;
  113. return $this;
  114. }
  115. public function getCategory(): ?Category
  116. {
  117. return $this->category;
  118. }
  119. public function setCategory(?Category $category): self
  120. {
  121. $this->category = $category;
  122. return $this;
  123. }
  124. /**
  125. * @return Collection|ProductWishlist[]
  126. */
  127. public function getProductWishlists(): Collection
  128. {
  129. return $this->productWishlists;
  130. }
  131. }