<?php
namespace App\Entity;
use App\Repository\CategoryAnnonceClientRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategoryAnnonceClientRepository::class)
*/
class CategoryAnnonceClient
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Annonce::class, mappedBy="categoryAnnonceClient")
*/
private $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): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Annonce[]
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonce $annonce): self
{
if (!$this->annonces->contains($annonce)) {
$this->annonces[] = $annonce;
$annonce->setCategoryAnnonceClient($this);
}
return $this;
}
public function removeAnnonce(Annonce $annonce): self
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getCategoryAnnonceClient() === $this) {
$annonce->setCategoryAnnonceClient(null);
}
}
return $this;
}
}