src/Entity/ProductFav.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductFavRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassProductFavRepository::class)]
  6. class ProductFav
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue(strategy"AUTO")]
  10.     #[ORM\Column(type"integer"uniquetrue)]
  11.     private $id;
  12.     #[ORM\Column(type"date")]
  13.     private $date;
  14.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'productFavUsers')]
  15.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  16.     private $user;
  17.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'productFavProducts')]
  18.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  19.     private $product;
  20.     public function getUser()
  21.     {
  22.         return $this->user->getId();
  23.     }
  24.     public function setUser(?User $user): void
  25.     {
  26.         $this->user $user;
  27.     }
  28.     public function getProduct()
  29.     {
  30.         return $this->product->getId();
  31.     }
  32.     public function setProduct(?Product $product): void
  33.     {
  34.         $this->product $product;
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getDate(): ?\DateTimeInterface
  41.     {
  42.         return $this->date;
  43.     }
  44.     public function setDate(\DateTimeInterface $date): self
  45.     {
  46.         $this->date $date;
  47.         return $this;
  48.     }
  49. }