<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\ActualiteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ActualiteRepository::class)]
#[ApiResource]
class Actualite
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $titre = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $imagedetails = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $desccourt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $nbvue = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $nbcommentaire = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\OneToMany(mappedBy: 'actualite', targetEntity: Trace::class,cascade: ['remove'])]
private Collection $traces;
#[ORM\Column(length: 255, nullable: true)]
private ?string $type = null;
public function __construct()
{
$this->traces = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(?string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getImagedetails(): ?string
{
return $this->imagedetails;
}
public function setImagedetails(?string $imagedetails): self
{
$this->imagedetails = $imagedetails;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDesccourt(): ?string
{
return $this->desccourt;
}
public function setDesccourt(?string $desccourt): self
{
$this->desccourt = $desccourt;
return $this;
}
public function getNbvue(): ?string
{
return $this->nbvue;
}
public function setNbvue(?string $nbvue): self
{
$this->nbvue = $nbvue;
return $this;
}
public function getNbcommentaire(): ?string
{
return $this->nbcommentaire;
}
public function setNbcommentaire(?string $nbcommentaire): self
{
$this->nbcommentaire = $nbcommentaire;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Trace>
*/
public function getTraces(): Collection
{
return $this->traces;
}
public function addTrace(Trace $trace): self
{
if (!$this->traces->contains($trace)) {
$this->traces->add($trace);
$trace->setActualite($this);
}
return $this;
}
public function removeTrace(Trace $trace): self
{
if ($this->traces->removeElement($trace)) {
// set the owning side to null (unless already changed)
if ($trace->getActualite() === $this) {
$trace->setActualite(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
}