src/Entity/Rate.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=RateRepository::class)
  9. */
  10. class Rate
  11. {
  12. /**
  13. * @ORM\Id()
  14. * @ORM\GeneratedValue()
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", length=40)
  20. */
  21. private $content;
  22. /**
  23. * @ORM\Column(type="float")
  24. */
  25. private $price;
  26. /**
  27. * @ORM\OneToMany(targetEntity=Product::class, mappedBy="rate")
  28. */
  29. private $products;
  30. /**
  31. * @ORM\Column(type="float", nullable=true)
  32. */
  33. private $tax;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private $abrev;
  38. public function __construct()
  39. {
  40. $this->products = new ArrayCollection();
  41. }
  42. public function getId(): ?int
  43. {
  44. return $this->id;
  45. }
  46. public function getContent(): ?string
  47. {
  48. return $this->content;
  49. }
  50. public function setContent(string $content): self
  51. {
  52. $this->content = $content;
  53. return $this;
  54. }
  55. public function getPrice(): ?float
  56. {
  57. return $this->price;
  58. }
  59. public function setPrice(float $price): self
  60. {
  61. $this->price = $price;
  62. return $this;
  63. }
  64. /**
  65. * @return Collection|Product[]
  66. */
  67. public function getProducts(): Collection
  68. {
  69. return $this->products;
  70. }
  71. public function addProduct(Product $product): self
  72. {
  73. if (!$this->products->contains($product)) {
  74. $this->products[] = $product;
  75. $product->setRate($this);
  76. }
  77. return $this;
  78. }
  79. public function removeProduct(Product $product): self
  80. {
  81. if ($this->products->contains($product)) {
  82. $this->products->removeElement($product);
  83. // set the owning side to null (unless already changed)
  84. if ($product->getRate() === $this) {
  85. $product->setRate(null);
  86. }
  87. }
  88. return $this;
  89. }
  90. public function __toString()
  91. {
  92. return $this->content;
  93. }
  94. public function getTax(): ?float
  95. {
  96. return $this->tax;
  97. }
  98. public function setTax(?float $tax): self
  99. {
  100. $this->tax = $tax;
  101. return $this;
  102. }
  103. public function getAbrev(): ?string
  104. {
  105. return $this->abrev;
  106. }
  107. public function setAbrev(?string $abrev): self
  108. {
  109. $this->abrev = $abrev;
  110. return $this;
  111. }
  112. }