<?php
namespace App\Entity;
use App\Repository\ComentarioBlogRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ComentarioBlogRepository::class)
*/
class ComentarioBlog
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Blog::class)
*/
private $blog;
/**
* @ORM\Column(type="text")
* @Assert\NotBlank(message="Debes ingresar el comentario")
*/
private $comentario;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $created_at;
/**
* @ORM\ManyToOne(targetEntity=Usuario::class)
*/
private $usuario;
public function __construct()
{
$this->created_at = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getBlog(): ?Blog
{
return $this->blog;
}
public function setBlog(?Blog $blog): self
{
$this->blog = $blog;
return $this;
}
public function getComentario(): ?string
{
return $this->comentario;
}
public function setComentario(string $comentario): self
{
$this->comentario = $comentario;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUsuario(): ?Usuario
{
return $this->usuario;
}
public function setUsuario(?Usuario $usuario): self
{
$this->usuario = $usuario;
return $this;
}
}