src/Entity/Product.php line 11

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