<?php
namespace App\Entity;
use App\Repository\CategoriesAnnoncesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CategoriesAnnoncesRepository::class)]
class CategoriesAnnonces
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(length: 255)]
private ?string $slug = null;
#[ORM\OneToMany(mappedBy: 'categoriesannonces', targetEntity: Annonces::class)]
private Collection $annonces;
public function __construct()
{
$this->annonces = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): static
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Annonces>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonces $annonce): static
{
if (!$this->annonces->contains($annonce)) {
$this->annonces->add($annonce);
$annonce->setCategoriesannonces($this);
}
return $this;
}
public function removeAnnonce(Annonces $annonce): static
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getCategoriesannonces() === $this) {
$annonce->setCategoriesannonces(null);
}
}
return $this;
}
}