src/Entity/CovFavorite.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CovFavoriteRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass:CovFavoriteRepository::class)]
  6. class CovFavorite
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue(strategy:'AUTO')]
  10.     #[ORM\Column(type:'integer'unique:true )]
  11.     private $id;
  12.     #[ORM\ManyToOne(targetEntity:Person::class, inversedBy:'covFavorites')]
  13.     #[ORM\JoinColumn(onDelete:'CASCADE')]
  14.     private $user;
  15.     #[ORM\ManyToOne(targetEntity:Person::class)]
  16.     #[ORM\JoinColumn(onDelete:'CASCADE')]
  17.     private $favorite;
  18.     public function getId(): ?int
  19.     {
  20.         return $this->id;
  21.     }
  22.     public function getUser(): ?int
  23.     {
  24.         return $this->user->getId();
  25.     }
  26.     public function setUser(?Person $user): self
  27.     {
  28.         $this->user $user;
  29.         return $this;
  30.     }
  31.     public function getFavorite(): ?int
  32.     {
  33.         return $this->favorite->getId();
  34.     }
  35.     public function setFavorite(?Person $favorite): self
  36.     {
  37.         $this->favorite $favorite;
  38.         return $this;
  39.     }
  40. }