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\Column(type="json", nullable=true, options={"comment":"Images avec traits de coupe (+rs langues)"})
  104.      */
  105.     private $imagesCropMarks;
  106.     /**
  107.      * @ORM\ManyToMany(targetEntity="App\Entity\TagAnnonce", inversedBy="annonces")
  108.      */
  109.     private $tags;
  110.     /**
  111.      * @ORM\ManyToMany(targetEntity="App\Entity\AnnonceSpace", mappedBy="annonces")
  112.      */
  113.     private $annonceSpaces;
  114.     /**
  115.      * @var \Doctrine\Common\Collections\Collection
  116.      * @ORM\OneToMany(targetEntity="App\Entity\EditionModeleRubriqueAnnonce", mappedBy="annonce", cascade={"persist","remove"}, orphanRemoval=true)
  117.      */
  118.     private $rubriqueAnnonces;
  119.     /**
  120.      * @ORM\ManyToMany(targetEntity="App\Entity\WebList", inversedBy="annonces")
  121.      */
  122.     private $webLists;
  123.     /**
  124.      * @ORM\ManyToOne(targetEntity="App\Entity\Diaporama", inversedBy="annonces")
  125.      * @ORM\JoinColumns({
  126.      *   @ORM\JoinColumn(name="display_id", referencedColumnName="id")
  127.      * })
  128.      */
  129.     private ?Diaporama $diaporama;
  130.     public function __construct()
  131.     {
  132.         $this->tags = new ArrayCollection();
  133.         $this->annonceSpaces = new ArrayCollection();
  134.         $this->rubriqueAnnonces = new ArrayCollection();
  135.         $this->webLists = new ArrayCollection();
  136.     }
  137.     public function getId() : ?int
  138.     {
  139.         return $this->id;
  140.     }
  141.     public function getName() : ?string
  142.     {
  143.         return $this->name;
  144.     }
  145.     public function setName(?string $name) : self
  146.     {
  147.         $this->name $name;
  148.         return $this;
  149.     }
  150.     public function getPublicationMode() : ?string
  151.     {
  152.         return $this->publicationMode;
  153.     }
  154.     public function setPublicationMode(?string $publicationMode) : self
  155.     {
  156.         $this->publicationMode $publicationMode;
  157.         return $this;
  158.     }
  159.     public function getAnnonceurName() : ?string
  160.     {
  161.         return $this->annonceurName;
  162.     }
  163.     public function setAnnonceurName(?string $annonceurName) : self
  164.     {
  165.         $this->annonceurName $annonceurName;
  166.         return $this;
  167.     }
  168.     public function getAnnonceurEmail() : ?string
  169.     {
  170.         return $this->annonceurEmail;
  171.     }
  172.     public function setAnnonceurEmail(?string $annonceurEmail) : self
  173.     {
  174.         $this->annonceurEmail $annonceurEmail;
  175.         return $this;
  176.     }
  177.     public function getStartDate() : ?DateTime
  178.     {
  179.         return $this->startDate;
  180.     }
  181.     public function setStartDate(?DateTime $startDate) : self
  182.     {
  183.         $this->startDate $startDate;
  184.         return $this;
  185.     }
  186.     public function getEndDate() : ?DateTime
  187.     {
  188.         return $this->endDate;
  189.     }
  190.     public function setEndDate(?DateTime $endDate) : self
  191.     {
  192.         $this->endDate $endDate;
  193.         return $this;
  194.     }
  195.     public function getLink() : ?string
  196.     {
  197.         return $this->link;
  198.     }
  199.     public function setLink(?string $link) : self
  200.     {
  201.         $this->link $link;
  202.         return $this;
  203.     }
  204.     public function getLinkTranslations() : ?array
  205.     {
  206.         return $this->linkTranslations;
  207.     }
  208.     public function setLinkTranslations(?array $linkTranslations) : self
  209.     {
  210.         $this->linkTranslations $linkTranslations;
  211.         return $this;
  212.     }
  213.     public function getDisplayCount() : ?array
  214.     {
  215.         return $this->displayCount;
  216.     }
  217.     public function setDisplayCount(?array $displayCount) : self
  218.     {
  219.         $this->displayCount $displayCount;
  220.         return $this;
  221.     }
  222.     public function getClickCount() : ?array
  223.     {
  224.         return $this->clickCount;
  225.     }
  226.     public function setClickCount(?array $clickCount) : self
  227.     {
  228.         $this->clickCount $clickCount;
  229.         return $this;
  230.     }
  231.     public function getAnnonceFormat() : ?AnnonceFormat
  232.     {
  233.         return $this->annonceFormat;
  234.     }
  235.     public function setAnnonceFormat(?AnnonceFormat $annonceFormat) : self
  236.     {
  237.         $this->annonceFormat $annonceFormat;
  238.         return $this;
  239.     }
  240.     public function getOwner() : ?User
  241.     {
  242.         return $this->owner;
  243.     }
  244.     public function setOwner(?User $owner) : self
  245.     {
  246.         $this->owner $owner;
  247.         return $this;
  248.     }
  249.     public function getEntity() : ?DnsitEntity
  250.     {
  251.         return $this->entity;
  252.     }
  253.     public function setEntity(?DnsitEntity $entity) : self
  254.     {
  255.         $this->entity $entity;
  256.         return $this;
  257.     }
  258. //    public function getMedia() : ?Media
  259. //    {
  260. //        return $this->media;
  261. //    }
  262. //    public function setMedia(?Media $media) : self
  263. //    {
  264. //        $this->media = $media;
  265. //        return $this;
  266. //    }
  267.     public function getImages() : ?array
  268.     {
  269.         return $this->images;
  270.     }
  271.     public function setImages(?array $images) : self
  272.     {
  273.         $this->images $images;
  274.         return $this;
  275.     }
  276.     public function getImagesCropMarks() : ?array
  277.     {
  278.         return $this->imagesCropMarks;
  279.     }
  280.     public function setImagesCropMarks(?array $imagesCropMarks) : self
  281.     {
  282.         $this->imagesCropMarks $imagesCropMarks;
  283.         return $this;
  284.     }
  285.     /**
  286.      * @return Collection|TagAnnonce[]
  287.      */
  288.     public function getTags() : Collection
  289.     {
  290.         return $this->tags;
  291.     }
  292.     public function addTag(TagAnnonce $tag) : self
  293.     {
  294.         if (!$this->tags->contains($tag)) {
  295.             $this->tags[] = $tag;
  296.         }
  297.         return $this;
  298.     }
  299.     public function removeTag(TagAnnonce $tag) : self
  300.     {
  301.         if ($this->tags->contains($tag)) {
  302.             $this->tags->removeElement($tag);
  303.         }
  304.         return $this;
  305.     }
  306.     /**
  307.      * @return Collection|AnnonceSpace[]
  308.      */
  309.     public function getAnnonceSpaces() : Collection
  310.     {
  311.         return $this->annonceSpaces;
  312.     }
  313.     public function addAnnonceSpace(AnnonceSpace $annonceSpace) : self
  314.     {
  315.         if (!$this->annonceSpaces->contains($annonceSpace)) {
  316.             $this->annonceSpaces[] = $annonceSpace;
  317.         }
  318.         return $this;
  319.     }
  320.     public function removeAnnonceSpace(AnnonceSpace $annonceSpace) : self
  321.     {
  322.         if ($this->annonceSpaces->contains($annonceSpace)) {
  323.             $this->annonceSpaces->removeElement($annonceSpace);
  324.         }
  325.         return $this;
  326.     }
  327.     /**
  328.      * @return Collection|EditionModeleRubriqueAnnonce[]
  329.      */
  330.     public function getRubriqueAnnonces(): Collection
  331.     {
  332.         return $this->rubriqueAnnonces;
  333.     }
  334.     public function addRubriqueAnnonce(EditionModeleRubriqueAnnonce $rubriqueAnnonce): self
  335.     {
  336.         if (!$this->rubriqueAnnonces->contains($rubriqueAnnonce)) {
  337.             $this->rubriqueAnnonces[] = $rubriqueAnnonce;
  338.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  339.             $rubriqueAnnonce->setAnnonce($this);
  340.         }
  341.         return $this;
  342.     }
  343.     public function removeRubriqueAnnonce(EditionModeleRubriqueAnnonce $rubriqueAnnonce): self
  344.     {
  345.         if ($this->rubriqueAnnonces->contains($rubriqueAnnonce)) {
  346.             $this->rubriqueAnnonces->removeElement($rubriqueAnnonce);
  347.             // passer l'autre côté à null pour éviter les incohérences
  348.             if ($rubriqueAnnonce->getAnnonce() === $this) {
  349.                 $rubriqueAnnonce->setAnnonce(null);
  350.             }
  351.         }
  352.         return $this;
  353.     }
  354.     /**
  355.      * @return Collection|WebList[]
  356.      */
  357.     public function getWebLists() : Collection
  358.     {
  359.         return $this->webLists;
  360.     }
  361.     public function addWebList(WebList $webList) : self
  362.     {
  363.         if (!$this->webLists->contains($webList)) {
  364.             $this->webLists[] = $webList;
  365.         }
  366.         return $this;
  367.     }
  368.     public function removeWebList(WebList $webList) : self
  369.     {
  370.         if ($this->webLists->contains($webList)) {
  371.             $this->webLists->removeElement($webList);
  372.         }
  373.         return $this;
  374.     }
  375.     public function getDiaporama() : ?Diaporama
  376.     {
  377.         return $this->diaporama;
  378.     }
  379.     public function setDiaporama(?Diaporama $diaporama) : self
  380.     {
  381.         $this->diaporama $diaporama;
  382.         return $this;
  383.     }
  384.     public function getCreatedAt() : ?DateTime
  385.     {
  386.         return $this->createdAt;
  387.     }
  388.     public function setCreatedAt(?DateTime $createdAt) : self
  389.     {
  390.         $this->createdAt $createdAt;
  391.         return $this;
  392.     }
  393.     public function getUpdatedAt() : ?DateTime
  394.     {
  395.         return $this->updatedAt;
  396.     }
  397.     public function setUpdatedAt(?DateTime $updatedAt) : self
  398.     {
  399.         $this->updatedAt $updatedAt;
  400.         return $this;
  401.     }
  402.     public function getState() : ?int
  403.     {
  404.         return $this->state;
  405.     }
  406.     public function setState(?int $state) : self
  407.     {
  408.         $this->state $state;
  409.         return $this;
  410.     }
  411. }