<?php
namespace App\Entity;
use App\Repository\TrendRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TrendRepository::class)
*/
class Trend
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Photo::class)
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $photo;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $created_at;
public function __construct($photo)
{
$this->photo = $photo;
$this->created_at = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getPhoto(): ?Photo
{
return $this->photo;
}
public function setPhoto(?Photo $photo): self
{
$this->photo = $photo;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
}