src/Entity/Annonce.php line 12

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. use DateTime;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\AnnonceRepository")
  9.  */
  10. class Annonce
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private ?int $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private ?string $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private ?string $publicationMode;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private ?string $annonceurName;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private ?string $annonceurEmail;
  34.     /**
  35.      * @ORM\Column(type="datetime")
  36.      */
  37.     private ?DateTime $startDate;
  38.     /**
  39.      * @ORM\Column(type="datetime")
  40.      */
  41.     private ?DateTime $endDate;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private ?string $link;
  46.     /**
  47.      * @ORM\Column(type="json", nullable=true)
  48.      */
  49.     private ?array $linkTranslations;
  50.     /**
  51.      * @ORM\Column(type="json", nullable=true)
  52.      */
  53.     private ?array $displayCount;
  54.     /**
  55.      * @ORM\Column(type="json", nullable=true)
  56.      */
  57.     private ?array $clickCount;
  58.     /**
  59.      * @ORM\Column(type="datetime", nullable=true)
  60.      */
  61.     private ?DateTime $createdAt;
  62.     /**
  63.      * @ORM\Column(type="datetime", nullable=true)
  64.      */
  65.     private ?DateTime $updatedAt;
  66.     /**
  67.      * @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
  68.      */
  69.     private ?int $state;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity="App\Entity\AnnonceFormat", inversedBy="annonces")
  72.      * @ORM\JoinColumns({
  73.      *   @ORM\JoinColumn(name="format_id", referencedColumnName="id")
  74.      * })
  75.      */
  76.     private ?AnnonceFormat $annonceFormat;
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="annonces")
  79.      * @ORM\JoinColumns({
  80.      *   @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
  81.      * })
  82.      */
  83.     private $owner;
  84.     /**
  85.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="annonces")
  86.      * @ORM\JoinColumns({
  87.      *   @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  88.      * })
  89.      */
  90.     private $entity;
  91. //    /**
  92. //     * @ORM\ManyToOne(targetEntity="App\Entity\Media", inversedBy="annonces")
  93. //     * @ORM\JoinColumns({
  94. //     *   @ORM\JoinColumn(name="media_id", referencedColumnName="id")
  95. //     * })
  96. //     */
  97. //    private ?Media $media;
  98.     /**
  99.      * @ORM\Column(type="json", nullable=true, options={"comment":"Images (+rs langues)"})
  100.      */
  101.     private $images;
  102.     /**
  103.      * @ORM\ManyToMany(targetEntity="App\Entity\TagAnnonce", inversedBy="annonces")
  104.      */
  105.     private $tags;
  106.     /**
  107.      * @ORM\ManyToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="annonces")
  108.      */
  109.     private $annonceSpaces;
  110.     /**
  111.      * @var \Doctrine\Common\Collections\Collection
  112.      * @ORM\OneToMany(targetEntity="App\Entity\EditionModeleRubriqueAnnonce", mappedBy="annonce", cascade={"persist","remove"}, orphanRemoval=true)
  113.      */
  114.     private $rubriqueAnnonces;
  115.     /**
  116.      * @ORM\ManyToMany(targetEntity="App\Entity\WebList", inversedBy="annonces")
  117.      */
  118.     private $webLists;
  119.     /**
  120.      * @ORM\ManyToOne(targetEntity="App\Entity\Diaporama", inversedBy="annonces")
  121.      * @ORM\JoinColumns({
  122.      *   @ORM\JoinColumn(name="display_id", referencedColumnName="id")
  123.      * })
  124.      */
  125.     private ?Diaporama $diaporama;
  126.     public function __construct()
  127.     {
  128.         $this->tags = new ArrayCollection();
  129.         $this->annonceSpaces = new ArrayCollection();
  130.         $this->rubriqueAnnonces = new ArrayCollection();
  131.         $this->webLists = new ArrayCollection();
  132.     }
  133.     public function getId() : ?int
  134.     {
  135.         return $this->id;
  136.     }
  137.     public function getName() : ?string
  138.     {
  139.         return $this->name;
  140.     }
  141.     public function setName(?string $name) : self
  142.     {
  143.         $this->name $name;
  144.         return $this;
  145.     }
  146.     public function getPublicationMode() : ?string
  147.     {
  148.         return $this->publicationMode;
  149.     }
  150.     public function setPublicationMode(?string $publicationMode) : self
  151.     {
  152.         $this->publicationMode $publicationMode;
  153.         return $this;
  154.     }
  155.     public function getAnnonceurName() : ?string
  156.     {
  157.         return $this->annonceurName;
  158.     }
  159.     public function setAnnonceurName(?string $annonceurName) : self
  160.     {
  161.         $this->annonceurName $annonceurName;
  162.         return $this;
  163.     }
  164.     public function getAnnonceurEmail() : ?string
  165.     {
  166.         return $this->annonceurEmail;
  167.     }
  168.     public function setAnnonceurEmail(?string $annonceurEmail) : self
  169.     {
  170.         $this->annonceurEmail $annonceurEmail;
  171.         return $this;
  172.     }
  173.     public function getStartDate() : ?DateTime
  174.     {
  175.         return $this->startDate;
  176.     }
  177.     public function setStartDate(?DateTime $startDate) : self
  178.     {
  179.         $this->startDate $startDate;
  180.         return $this;
  181.     }
  182.     public function getEndDate() : ?DateTime
  183.     {
  184.         return $this->endDate;
  185.     }
  186.     public function setEndDate(?DateTime $endDate) : self
  187.     {
  188.         $this->endDate $endDate;
  189.         return $this;
  190.     }
  191.     public function getLink() : ?string
  192.     {
  193.         return $this->link;
  194.     }
  195.     public function setLink(?string $link) : self
  196.     {
  197.         $this->link $link;
  198.         return $this;
  199.     }
  200.     public function getLinkTranslations() : ?array
  201.     {
  202.         return $this->linkTranslations;
  203.     }
  204.     public function setLinkTranslations(?array $linkTranslations) : self
  205.     {
  206.         $this->linkTranslations $linkTranslations;
  207.         return $this;
  208.     }
  209.     public function getDisplayCount() : ?array
  210.     {
  211.         return $this->displayCount;
  212.     }
  213.     public function setDisplayCount(?array $displayCount) : self
  214.     {
  215.         $this->displayCount $displayCount;
  216.         return $this;
  217.     }
  218.     public function getClickCount() : ?array
  219.     {
  220.         return $this->clickCount;
  221.     }
  222.     public function setClickCount(?array $clickCount) : self
  223.     {
  224.         $this->clickCount $clickCount;
  225.         return $this;
  226.     }
  227.     public function getAnnonceFormat() : ?AnnonceFormat
  228.     {
  229.         return $this->annonceFormat;
  230.     }
  231.     public function setAnnonceFormat(?AnnonceFormat $annonceFormat) : self
  232.     {
  233.         $this->annonceFormat $annonceFormat;
  234.         return $this;
  235.     }
  236.     public function getOwner() : ?User
  237.     {
  238.         return $this->owner;
  239.     }
  240.     public function setOwner(?User $owner) : self
  241.     {
  242.         $this->owner $owner;
  243.         return $this;
  244.     }
  245.     public function getEntity() : ?DnsitEntity
  246.     {
  247.         return $this->entity;
  248.     }
  249.     public function setEntity(?DnsitEntity $entity) : self
  250.     {
  251.         $this->entity $entity;
  252.         return $this;
  253.     }
  254. //    public function getMedia() : ?Media
  255. //    {
  256. //        return $this->media;
  257. //    }
  258. //    public function setMedia(?Media $media) : self
  259. //    {
  260. //        $this->media = $media;
  261. //        return $this;
  262. //    }
  263.     public function getImages() : ?array
  264.     {
  265.         return $this->images;
  266.     }
  267.     public function setImages(?array $images) : self
  268.     {
  269.         $this->images $images;
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection|TagAnnonce[]
  274.      */
  275.     public function getTags() : Collection
  276.     {
  277.         return $this->tags;
  278.     }
  279.     public function addTag(TagAnnonce $tag) : self
  280.     {
  281.         if (!$this->tags->contains($tag)) {
  282.             $this->tags[] = $tag;
  283.         }
  284.         return $this;
  285.     }
  286.     public function removeTag(TagAnnonce $tag) : self
  287.     {
  288.         if ($this->tags->contains($tag)) {
  289.             $this->tags->removeElement($tag);
  290.         }
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection|AnnonceSpace[]
  295.      */
  296.     public function getAnnonceSpaces() : Collection
  297.     {
  298.         return $this->annonceSpaces;
  299.     }
  300.     public function addAnnonceSpace(AnnonceSpace $annonceSpace) : self
  301.     {
  302.         if (!$this->annonceSpaces->contains($annonceSpace)) {
  303.             $this->annonceSpaces[] = $annonceSpace;
  304.         }
  305.         return $this;
  306.     }
  307.     public function removeAnnonceSpace(AnnonceSpace $annonceSpace) : self
  308.     {
  309.         if ($this->annonceSpaces->contains($annonceSpace)) {
  310.             $this->annonceSpaces->removeElement($annonceSpace);
  311.         }
  312.         return $this;
  313.     }
  314.     /**
  315.      * @return Collection|EditionModeleRubriqueAnnonce[]
  316.      */
  317.     public function getRubriqueAnnonces(): Collection
  318.     {
  319.         return $this->rubriqueAnnonces;
  320.     }
  321.     public function addRubriqueAnnonce(EditionModeleRubriqueAnnonce $rubriqueAnnonce): self
  322.     {
  323.         if (!$this->rubriqueAnnonces->contains($rubriqueAnnonce)) {
  324.             $this->rubriqueAnnonces[] = $rubriqueAnnonce;
  325.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  326.             $rubriqueAnnonce->setAnnonce($this);
  327.         }
  328.         return $this;
  329.     }
  330.     public function removeRubriqueAnnonce(EditionModeleRubriqueAnnonce $rubriqueAnnonce): self
  331.     {
  332.         if ($this->rubriqueAnnonces->contains($rubriqueAnnonce)) {
  333.             $this->rubriqueAnnonces->removeElement($rubriqueAnnonce);
  334.             // passer l'autre côté à null pour éviter les incohérences
  335.             if ($rubriqueAnnonce->getAnnonce() === $this) {
  336.                 $rubriqueAnnonce->setAnnonce(null);
  337.             }
  338.         }
  339.         return $this;
  340.     }
  341.     /**
  342.      * @return Collection|WebList[]
  343.      */
  344.     public function getWebLists() : Collection
  345.     {
  346.         return $this->webLists;
  347.     }
  348.     public function addWebList(WebList $webList) : self
  349.     {
  350.         if (!$this->webLists->contains($webList)) {
  351.             $this->webLists[] = $webList;
  352.         }
  353.         return $this;
  354.     }
  355.     public function removeWebList(WebList $webList) : self
  356.     {
  357.         if ($this->webLists->contains($webList)) {
  358.             $this->webLists->removeElement($webList);
  359.         }
  360.         return $this;
  361.     }
  362.     public function getDiaporama() : ?Diaporama
  363.     {
  364.         return $this->diaporama;
  365.     }
  366.     public function setDiaporama(?Diaporama $diaporama) : self
  367.     {
  368.         $this->diaporama $diaporama;
  369.         return $this;
  370.     }
  371.     public function getCreatedAt() : ?DateTime
  372.     {
  373.         return $this->createdAt;
  374.     }
  375.     public function setCreatedAt(?DateTime $createdAt) : self
  376.     {
  377.         $this->createdAt $createdAt;
  378.         return $this;
  379.     }
  380.     public function getUpdatedAt() : ?DateTime
  381.     {
  382.         return $this->updatedAt;
  383.     }
  384.     public function setUpdatedAt(?DateTime $updatedAt) : self
  385.     {
  386.         $this->updatedAt $updatedAt;
  387.         return $this;
  388.     }
  389.     public function getState() : ?int
  390.     {
  391.         return $this->state;
  392.     }
  393.     public function setState(?int $state) : self
  394.     {
  395.         $this->state $state;
  396.         return $this;
  397.     }
  398. }