<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\TagAnnonceRepository")
*/
class TagAnnonce
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $name;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Annonce", mappedBy="tags")
*/
private $annonces;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\AnnonceFormat", mappedBy="tags")
*/
private $annonceFormats;
// /**
// * @ORM\ManyToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="tags")
// */
// private $annonceSpaces;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\EditionModeleRubrique", mappedBy="tagAnnonce", cascade={"persist"})
* @ORM\OrderBy({"ordering" = "ASC"})
*/
private $rubriques;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="tagAnnonce", cascade={"persist"})
*/
private $annonceSpaces;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="tagAnnonces")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
* })
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="tagAnnonces")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
private $entity;
public function __construct()
{
$this->annonces = new ArrayCollection();
$this->annonceFormats = new ArrayCollection();
$this->annonceSpaces = new ArrayCollection();
$this->rubriques = 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->addTag($this);
}
return $this;
}
public function removeAnnonce(Annonce $annonce) : self
{
if ($this->annonces->contains($annonce)) {
$this->annonces->removeElement($annonce);
$annonce->removeTag($this);
}
return $this;
}
/**
* @return Collection|AnnonceFormat[]
*/
public function getAnnonceFormats() : Collection
{
return $this->annonceFormats;
}
public function addAnnonceFormat(AnnonceFormat $annonceFormat) : self
{
if (!$this->annonceFormats->contains($annonceFormat)) {
$this->annonceFormats[] = $annonceFormat;
$annonceFormat->addTag($this);
}
return $this;
}
public function removeAnnonceFormat(AnnonceFormat $annonceFormat) : self
{
if ($this->annonceFormats->contains($annonceFormat)) {
$this->annonceFormats->removeElement($annonceFormat);
$annonceFormat->removeTag($this);
}
return $this;
}
/**
* @return Collection|AnnonceSpace[]
*/
public function getAnnonceSpaces() : Collection
{
return $this->annonceSpaces;
}
public function addAnnonceSpace(AnnonceSpace $annonceSpace) : self
{
if (!$this->annonceSpaces->contains($annonceSpace)) {
$this->annonceSpaces[] = $annonceSpace;
$annonceSpace->addTagAnnonce($this);
}
return $this;
}
public function removeAnnonceSpace(AnnonceSpace $annonceSpace) : self
{
if ($this->annonceSpaces->contains($annonceSpace)) {
$this->annonceSpaces->removeElement($annonceSpace);
$annonceSpace->removeTagAnnonce($this);
}
return $this;
}
/**
* @return Collection|EditionModeleRubrique[]
*/
public function getRubriques() : Collection
{
return $this->rubriques;
}
public function addRubrique(EditionModeleRubrique $rubrique) : self
{
if (!$this->rubriques->contains($rubrique)) {
$this->rubriques[] = $rubrique;
$rubrique->setTagAnnonce($this);
}
return $this;
}
public function removeRubrique(EditionModeleRubrique $rubrique) : self
{
if ($this->rubriques->contains($rubrique)) {
$this->rubriques->removeElement($rubrique);
// set the owning side to null (unless already changed)
if ($rubrique->getTagAnnonce() === $this) {
$rubrique->setTagAnnonce(null);
}
}
return $this;
}
public function getOwner() : ?User
{
return $this->owner;
}
public function setOwner(?User $owner) : self
{
$this->owner = $owner;
return $this;
}
public function getEntity() : ?DnsitEntity
{
return $this->entity;
}
public function setEntity(?DnsitEntity $entity) : self
{
$this->entity = $entity;
return $this;
}
// /**
// * @return Collection|AnnonceSpace[]
// */
// public function getSpaceTagAnnonces() : Collection
// {
// return $this->spaceTagAnnonces;
// }
// public function addSpaceTagAnnonce(AnnonceSpace $spaceTagAnnonce) : self
// {
// if (!$this->spaceTagAnnonces->contains($spaceTagAnnonce)) {
// $this->spaceTagAnnonces[] = $spaceTagAnnonce;
// $spaceTagAnnonce->setTagAnnonce($this);
// }
// return $this;
// }
// public function removeSpaceTagAnnonce(AnnonceSpace $spaceTagAnnonce) : self
// {
// if ($this->spaceTagAnnonces->contains($spaceTagAnnonce)) {
// $this->spaceTagAnnonces->removeElement($spaceTagAnnonce);
// // set the owning side to null (unless already changed)
// if ($spaceTagAnnonce->getTagAnnonce() === $this) {
// $spaceTagAnnonce->setTagAnnonce(null);
// }
// }
// return $this;
// }
}