<?php
namespace App\Entity;
use App\Repository\PhotoLikeRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PhotoLikeRepository::class)
*/
class PhotoLike
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="photoLikes")
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Photo::class, inversedBy="photoLikes")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $photo;
/**
* @ORM\ManyToOne(targetEntity=Video::class, inversedBy="photoLikes")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $video;
public function __construct()
{
$this->created_at = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getPhoto(): ?Photo
{
return $this->photo;
}
public function setPhoto(?Photo $photo): self
{
$this->photo = $photo;
return $this;
}
public function getVideo(): ?Video
{
return $this->video;
}
public function setVideo(?Video $video): self
{
$this->video = $video;
return $this;
}
}