<?php
namespace App\Entity;
use App\Repository\PostReponsesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PostReponsesRepository::class)]
class PostReponses
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $texte = null;
#[ORM\ManyToMany(targetEntity: Post::class, mappedBy: 'reponses')]
private mixed $posts;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $count = 0;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $valide;
public function __construct()
{
$this->posts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTexte(): ?string
{
return $this->texte;
}
public function setTexte(?string $texte): self
{
$this->texte = $texte;
return $this;
}
/**
* @return Collection
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->addReponse($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
$post->removeReponse($this);
}
return $this;
}
public function getCount(): ?int
{
return $this->count;
}
public function setCount(?int $count): self
{
$this->count = $count;
return $this;
}
public function __toString(): string
{
return (string)$this->texte;
}
public function getValide(): ?bool
{
return $this->valide;
}
public function setValide(?bool $valide): self
{
$this->valide = $valide;
return $this;
}
}