<?php
namespace App\Entity;
use App\Entity\Contact;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Sulu\Bundle\CategoryBundle\Entity\Category as SuluCategory;
use JMS\Serializer\Annotation\ExclusionPolicy;
/**
* @ORM\Entity()
* @ORM\Table(name="ca_categories")
* @ExclusionPolicy("all")
*
*/
class Category extends SuluCategory
{
/**
* @ORM\Column(type="array", length=255, nullable=true)
*/
private ?array $pageLink;
/**
* @ORM\Column(type="string", length=63, nullable=true)
*/
private ?string $color;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="departement")
*/
private $contacts;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="territoireInterv")
*/
private $territoireContacts;
/**
* @ORM\ManyToMany(targetEntity=Contact::class, mappedBy="optins")
*/
private $optinsContacts;
public function __construct()
{
parent::__construct();
$this->contacts = new ArrayCollection();
$this->optinsContacts = new ArrayCollection();
}
public function getPageLink(): ?array
{
return $this->pageLink;
}
public function setPageLink(?array $pageLink): void
{
$this->pageLink = $pageLink;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): void
{
$this->color = $color;
}
/**
* @return Collection<int, Contact>
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
$contact->setDepartement($this);
}
return $this;
}
public function removeContact(Contact $contact): self
{
if ($this->contacts->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getDepartement() === $this) {
$contact->setDepartement(null);
}
}
return $this;
}
/**
* @return Collection<int, Contact>
*/
public function getTerritoireContacts(): Collection
{
return $this->territoireContacts;
}
public function addTerritoireContact(Contact $territoireContact): self
{
if (!$this->territoireContacts->contains($territoireContact)) {
$this->territoireContacts[] = $territoireContact;
$territoireContact->setDepartement($this);
}
return $this;
}
public function removeTerritoireContact(Contact $territoireContact): self
{
if ($this->territoireContacts->removeElement($territoireContact)) {
// set the owning side to null (unless already changed)
if ($territoireContact->getDepartement() === $this) {
$territoireContact->setDepartement(null);
}
}
return $this;
}
/**
* @return Collection<int, Contact>
*/
public function getOptins(): Collection
{
return $this->optinsContacts;
}
public function addOptin(Contact $optin): self
{
if (!$this->optinsContacts->contains($optin)) {
$this->optinsContacts[] = $optin;
$optin->addOptin($this);
}
return $this;
}
public function removeOptin(Contact $optin): self
{
if ($this->optinsContacts->removeElement($optin)) {
$optin->removeOptin($this);
}
return $this;
}
}