src/Entity/TagAnnonce.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\TagAnnonceRepository")
  8.  */
  9. class TagAnnonce
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private ?string $name;
  21.     /**
  22.      * @ORM\ManyToMany(targetEntity="App\Entity\Annonce", mappedBy="tags")
  23.      */
  24.     private $annonces;
  25.     /**
  26.      * @ORM\ManyToMany(targetEntity="App\Entity\AnnonceFormat", mappedBy="tags")
  27.      */
  28.     private $annonceFormats;
  29. //    /**
  30. //     * @ORM\ManyToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="tags")
  31. //     */
  32. //    private $annonceSpaces;
  33.     /**
  34.      * @var Collection
  35.      *
  36.      * @ORM\OneToMany(targetEntity="App\Entity\EditionModeleRubrique", mappedBy="tagAnnonce", cascade={"persist"})
  37.      * @ORM\OrderBy({"ordering" = "ASC"})
  38.      */
  39.     private $rubriques;
  40.     /**
  41.      * @var Collection
  42.      *
  43.      * @ORM\OneToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="tagAnnonce", cascade={"persist"})
  44.      */
  45.     private $annonceSpaces;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="tagAnnonces")
  48.      * @ORM\JoinColumns({
  49.      *   @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
  50.      * })
  51.      */
  52.     private $owner;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="tagAnnonces")
  55.      * @ORM\JoinColumns({
  56.      *   @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  57.      * })
  58.      */
  59.     private $entity;
  60.     public function __construct()
  61.     {
  62.         $this->annonces = new ArrayCollection();
  63.         $this->annonceFormats = new ArrayCollection();
  64.         $this->annonceSpaces = new ArrayCollection();
  65.         $this->rubriques = new ArrayCollection();
  66.     }
  67.     public function getId() : ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getName() : ?string
  72.     {
  73.         return $this->name;
  74.     }
  75.     public function setName(string $name) : self
  76.     {
  77.         $this->name $name;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|Annonce[]
  82.      */
  83.     public function getAnnonces() : Collection
  84.     {
  85.         return $this->annonces;
  86.     }
  87.     public function addAnnonce(Annonce $annonce) : self
  88.     {
  89.         if (!$this->annonces->contains($annonce)) {
  90.             $this->annonces[] = $annonce;
  91.             $annonce->addTag($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeAnnonce(Annonce $annonce) : self
  96.     {
  97.         if ($this->annonces->contains($annonce)) {
  98.             $this->annonces->removeElement($annonce);
  99.             $annonce->removeTag($this);
  100.         }
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection|AnnonceFormat[]
  105.      */
  106.     public function getAnnonceFormats() : Collection
  107.     {
  108.         return $this->annonceFormats;
  109.     }
  110.     public function addAnnonceFormat(AnnonceFormat $annonceFormat) : self
  111.     {
  112.         if (!$this->annonceFormats->contains($annonceFormat)) {
  113.             $this->annonceFormats[] = $annonceFormat;
  114.             $annonceFormat->addTag($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeAnnonceFormat(AnnonceFormat $annonceFormat) : self
  119.     {
  120.         if ($this->annonceFormats->contains($annonceFormat)) {
  121.             $this->annonceFormats->removeElement($annonceFormat);
  122.             $annonceFormat->removeTag($this);
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection|AnnonceSpace[]
  128.      */
  129.     public function getAnnonceSpaces() : Collection
  130.     {
  131.         return $this->annonceSpaces;
  132.     }
  133.     public function addAnnonceSpace(AnnonceSpace $annonceSpace) : self
  134.     {
  135.         if (!$this->annonceSpaces->contains($annonceSpace)) {
  136.             $this->annonceSpaces[] = $annonceSpace;
  137.             $annonceSpace->addTagAnnonce($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeAnnonceSpace(AnnonceSpace $annonceSpace) : self
  142.     {
  143.         if ($this->annonceSpaces->contains($annonceSpace)) {
  144.             $this->annonceSpaces->removeElement($annonceSpace);
  145.             $annonceSpace->removeTagAnnonce($this);
  146.         }
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection|EditionModeleRubrique[]
  151.      */
  152.     public function getRubriques() : Collection
  153.     {
  154.         return $this->rubriques;
  155.     }
  156.     public function addRubrique(EditionModeleRubrique $rubrique) : self
  157.     {
  158.         if (!$this->rubriques->contains($rubrique)) {
  159.             $this->rubriques[] = $rubrique;
  160.             $rubrique->setTagAnnonce($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeRubrique(EditionModeleRubrique $rubrique) : self
  165.     {
  166.         if ($this->rubriques->contains($rubrique)) {
  167.             $this->rubriques->removeElement($rubrique);
  168.             // set the owning side to null (unless already changed)
  169.             if ($rubrique->getTagAnnonce() === $this) {
  170.                 $rubrique->setTagAnnonce(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     public function getOwner() : ?User
  176.     {
  177.         return $this->owner;
  178.     }
  179.     public function setOwner(?User $owner) : self
  180.     {
  181.         $this->owner $owner;
  182.         return $this;
  183.     }
  184.     public function getEntity() : ?DnsitEntity
  185.     {
  186.         return $this->entity;
  187.     }
  188.     public function setEntity(?DnsitEntity $entity) : self
  189.     {
  190.         $this->entity $entity;
  191.         return $this;
  192.     }
  193. //    /**
  194. //     * @return Collection|AnnonceSpace[]
  195. //     */
  196. //    public function getSpaceTagAnnonces() : Collection
  197. //    {
  198. //        return $this->spaceTagAnnonces;
  199. //    }
  200. //    public function addSpaceTagAnnonce(AnnonceSpace $spaceTagAnnonce) : self
  201. //    {
  202. //        if (!$this->spaceTagAnnonces->contains($spaceTagAnnonce)) {
  203. //            $this->spaceTagAnnonces[] = $spaceTagAnnonce;
  204. //            $spaceTagAnnonce->setTagAnnonce($this);
  205. //        }
  206. //        return $this;
  207. //    }
  208. //    public function removeSpaceTagAnnonce(AnnonceSpace $spaceTagAnnonce) : self
  209. //    {
  210. //        if ($this->spaceTagAnnonces->contains($spaceTagAnnonce)) {
  211. //            $this->spaceTagAnnonces->removeElement($spaceTagAnnonce);
  212. //            // set the owning side to null (unless already changed)
  213. //            if ($spaceTagAnnonce->getTagAnnonce() === $this) {
  214. //                $spaceTagAnnonce->setTagAnnonce(null);
  215. //            }
  216. //        }
  217. //        return $this;
  218. //    }
  219. }