src/Entity/FavoriteProduct.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrderRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Table(name: '`favorite_product`')]
  8. #[ORM\Entity(repositoryClass: FavoriteProductRepository::class)]
  9. class FavoriteProduct
  10. {
  11. #[ORM\Id]
  12. #[ORM\GeneratedValue]
  13. #[ORM\Column(type: 'integer')]
  14. private $id;
  15. #[ORM\ManyToOne(targetEntity: User::class)]
  16. #[ORM\JoinColumn(nullable: false)]
  17. private $user;
  18. #[ORM\ManyToOne(targetEntity: Product::class, inversedBy:"favoriteProducts")]
  19. #[ORM\JoinColumn(nullable: false)]
  20. private $product;
  21. public function __construct()
  22. {
  23. }
  24. public function getId(): ?int
  25. {
  26. return $this->id;
  27. }
  28. public function getUser(): ?User
  29. {
  30. return $this->user;
  31. }
  32. public function setUser(?User $user): self
  33. {
  34. $this->user = $user;
  35. return $this;
  36. }
  37. public function getProduct(): ?Product
  38. {
  39. return $this->product;
  40. }
  41. public function setProduct(?Product $product): self
  42. {
  43. $this->product = $product;
  44. return $this;
  45. }
  46. }