<?php
namespace App\Entity;
use App\Repository\CommentaireRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommentaireRepository::class)]
class Commentaire
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\JoinColumn(nullable: false)]
#[ORM\ManyToOne(targetEntity: User::class)]
private $user;
#[ORM\JoinColumn(nullable: false)]
#[ORM\ManyToOne(targetEntity: News::class, inversedBy: 'commentaires')]
private $news;
#[ORM\Column(type: 'text')]
private $message;
#[ORM\Column(type: 'boolean', nullable: true)]
private $status;
#[ORM\Column(type: 'datetime')]
private $create_at;
public function __construct()
{
//$this->type = new ArrayCollection();
$this->status=false;
$this->create_at=new \DateTime();
//$this->commentaires = new ArrayCollection();
}
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 getNews(): ?News
{
return $this->news;
}
public function setNews(?News $news): self
{
$this->news = $news;
return $this;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(string $message): self
{
$this->message = $message;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function getCreateAt(): ?\DateTimeInterface
{
return $this->create_at;
}
public function setCreateAt(\DateTimeInterface $create_at): self
{
$this->create_at = $create_at;
return $this;
}
}