src/Entity/PhotoLike.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PhotoLikeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=PhotoLikeRepository::class)
  7.  */
  8. class PhotoLike
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="photoLikes")
  18.      * @ORM\JoinColumn(nullable=false)
  19.      */
  20.     private $user;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=Photo::class, inversedBy="photoLikes")
  23.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  24.      */
  25.     private $photo;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Video::class, inversedBy="photoLikes")
  28.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  29.      */
  30.     private $video;
  31.     public function __construct()
  32.     {
  33.         $this->created_at = new \DateTimeImmutable();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getUser(): ?User
  40.     {
  41.         return $this->user;
  42.     }
  43.     public function setUser(?User $user): self
  44.     {
  45.         $this->user $user;
  46.         return $this;
  47.     }
  48.     public function getPhoto(): ?Photo
  49.     {
  50.         return $this->photo;
  51.     }
  52.     public function setPhoto(?Photo $photo): self
  53.     {
  54.         $this->photo $photo;
  55.         return $this;
  56.     }
  57.     public function getVideo(): ?Video
  58.     {
  59.         return $this->video;
  60.     }
  61.     public function setVideo(?Video $video): self
  62.     {
  63.         $this->video $video;
  64.         return $this;
  65.     }
  66. }