<?php
namespace App\Entity;
use App\Repository\CategoryAnnoncePrestataireRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategoryAnnoncePrestataireRepository::class)
*/
class CategoryAnnoncePrestataire
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=AnnonceCompany::class, mappedBy="categoryAnnoncePrestataire")
*/
private $annonceCompanys;
public function __construct()
{
$this->annonceCompanys = 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|AnnonceCompany[]
*/
public function getAnnonceCompanys(): Collection
{
return $this->annonceCompanys;
}
public function addAnnonceCompany(AnnonceCompany $annonceCompany): self
{
if (!$this->annonceCompanys->contains($annonceCompany)) {
$this->annonceCompanys[] = $annonceCompany;
$annonceCompany->setCategoryAnnoncePrestataire($this);
}
return $this;
}
public function removeAnnonceCompany(AnnonceCompany $annonceCompany): self
{
if ($this->annonceCompanys->removeElement($annonceCompany)) {
// set the owning side to null (unless already changed)
if ($annonceCompany->getCategoryAnnoncePrestataire() === $this) {
$annonceCompany->setCategoryAnnoncePrestataire(null);
}
}
return $this;
}
}