src/Entity/Contact.php line 16

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 Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. /**
  9.  * @Vich\Uploadable
  10.  */
  11. #[ORM\Entity(repositoryClass\App\Repository\ContactRepository::class)]
  12. class Contact implements \Stringable
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type'integer')]
  17.     private ?int $id null;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private ?string $first_namenull;
  20.     #[ORM\Column(type'string'length255nullabletrue)]
  21.     private ?string $last_namenull;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private ?string $picturenull;
  24.     /**
  25.      * @Vich\UploadableField(mapping="images", fileNameProperty="picture")
  26.      */
  27.     private ?\Symfony\Component\HttpFoundation\File\File $picture_file null;
  28.     #[ORM\Column(type'text'nullabletrue)]
  29.     private ?string $short_descriptionnull;
  30.     #[ORM\Column(type'string'length255nullabletrue)]
  31.     private ?string $long_descriptionnull;
  32.     #[ORM\ManyToOne(targetEntity\App\Entity\Territory::class, inversedBy'contacts')]
  33.     private mixed $territory;
  34.     #[ORM\Column(type'text'nullabletrue)]
  35.     private ?string $display_addressnull;
  36.     #[ORM\Column(type'string'length255nullabletrue)]
  37.     private ?string $emailnull;
  38.     #[ORM\Column(type'string'length255nullabletrue)]
  39.     private ?string $phonenull;
  40.     #[ORM\Column(type'string'length255nullabletrue)]
  41.     private ?string $acceonull;
  42.     #[ORM\Column(type'string'length255nullabletrue)]
  43.     private ?string $link_1null;
  44.     #[ORM\Column(type'string'length255nullabletrue)]
  45.     private ?string $link_2null;
  46.     #[ORM\ManyToMany(targetEntity\App\Entity\Post::class, mappedBy'contacts'cascade: ['persist''remove'])]
  47.     private mixed $posts;
  48.     #[ORM\OneToMany(targetEntity\App\Entity\Post::class, mappedBy'contact1'cascade: ['persist''remove'])]
  49.     private mixed $posts1;
  50.     #[ORM\OneToMany(targetEntity\App\Entity\Post::class, mappedBy'contact2'cascade: ['persist''remove'])]
  51.     private mixed $posts2;
  52.     #[ORM\OneToMany(targetEntity\App\Entity\Post::class, mappedBy'contact3'cascade: ['persist''remove'])]
  53.     private mixed $posts3;
  54.     #[ORM\ManyToOne(targetEntity\App\Entity\Cantons::class, inversedBy'contacts'cascade: ['persist''remove'])]
  55.     #[ORM\JoinColumn(onDelete'SET NULL')]
  56.     private mixed $canton;
  57.     #[ORM\Column(type'string'length255nullabletrue)]
  58.     private ?string $ruenull;
  59.     #[ORM\Column(type'string'length255nullabletrue)]
  60.     private ?string $code_postalnull;
  61.     #[ORM\Column(type'string'length255nullabletrue)]
  62.     private ?string $villenull;
  63.     #[ORM\Column(type'string'length255nullabletrue)]
  64.     private ?string $latnull;
  65.     #[ORM\Column(type'string'length255nullabletrue)]
  66.     private ?string $lngnull;
  67.     #[ORM\OneToMany(targetEntity\App\Entity\Pages::class, mappedBy'contact1')]
  68.     private mixed $pages;
  69.     #[ORM\OneToMany(targetEntity\App\Entity\Pages::class, mappedBy'contact2')]
  70.     private mixed $pages2;
  71.     #[ORM\OneToMany(targetEntity\App\Entity\Pages::class, mappedBy'contact3')]
  72.     private mixed $pages3;
  73.     #[ORM\ManyToOne(targetEntity\App\Entity\TypeContact::class, inversedBy'contacts')]
  74.     private mixed $type_contact;
  75.     #[ORM\Column(type'string'length255nullabletrue)]
  76.     private ?string $typenull;
  77.     #[ORM\Column(type'string'length255nullabletrue)]
  78.     private ?string $slugnull;
  79.     #[ORM\Column(type'datetime'nullabletrue)]
  80.     private $date_update;
  81.     #[ORM\Column(type'boolean'nullabletrue)]
  82.     private ?bool $active;
  83.     #[ORM\OneToMany(targetEntityCitation::class, mappedBy'elu')]
  84.     private mixed $citations;
  85.     #[ORM\ManyToMany(targetEntityPolitiqueDepartementale::class, mappedBy'contacts')]
  86.     private mixed $politiqueDepartementales;
  87.     #[ORM\Column(type'string'length255nullabletrue)]
  88.     private ?string $civilitenull;
  89.     #[ORM\ManyToMany(targetEntityPageSatellite::class, mappedBy'contacts')]
  90.     private Collection $pageSatellites;
  91.     public function __construct()
  92.     {
  93.         $this->posts = new ArrayCollection();
  94.         $this->posts1 = new ArrayCollection();
  95.         $this->posts2 = new ArrayCollection();
  96.         $this->posts3 = new ArrayCollection();
  97.         $this->pages = new ArrayCollection();
  98.         $this->pages2 = new ArrayCollection();
  99.         $this->pages3 = new ArrayCollection();
  100.         $this->citations = new ArrayCollection();
  101.         $this->politiqueDepartementales = new ArrayCollection();
  102.         $this->pageSatellites = new ArrayCollection();
  103.     }
  104.     public function setPictureFile(File $file null): void
  105.     {
  106.         $this->picture_file $file;
  107.         if ($file) {
  108.             $date_update = new \DateTime('now');
  109.             $this->date_update $date_update;
  110.         }
  111.     }
  112.     public function getPictureFile(): mixed
  113.     {
  114.         return $this->picture_file;
  115.     }
  116.     public function getId(): ?int
  117.     {
  118.         return $this->id;
  119.     }
  120.     public function getFirstName(): ?string
  121.     {
  122.         return $this->first_name;
  123.     }
  124.     public function setFirstName(?string $first_name): self
  125.     {
  126.         $this->first_name $first_name;
  127.         return $this;
  128.     }
  129.     public function getLastName(): ?string
  130.     {
  131.         return $this->last_name;
  132.     }
  133.     public function setLastName(?string $last_name): self
  134.     {
  135.         $this->last_name $last_name;
  136.         return $this;
  137.     }
  138.     public function getPicture(): ?string
  139.     {
  140.         return $this->picture;
  141.     }
  142.     public function setPicture(?string $picture): self
  143.     {
  144.         $this->picture $picture;
  145.         return $this;
  146.     }
  147.     public function getShortDescription(): ?string
  148.     {
  149.         return $this->short_description;
  150.     }
  151.     public function setShortDescription(?string $short_description): self
  152.     {
  153.         $this->short_description $short_description;
  154.         return $this;
  155.     }
  156.     public function getLongDescription(): ?string
  157.     {
  158.         return $this->long_description;
  159.     }
  160.     public function setLongDescription(?string $long_description): self
  161.     {
  162.         $this->long_description $long_description;
  163.         return $this;
  164.     }
  165.     public function getTerritory(): ?Territory
  166.     {
  167.         return $this->territory;
  168.     }
  169.     public function setTerritory(?Territory $territory): self
  170.     {
  171.         $this->territory $territory;
  172.         return $this;
  173.     }
  174.     public function getDisplayAddress(): ?string
  175.     {
  176.         return $this->display_address;
  177.     }
  178.     public function setDisplayAddress(?string $display_address): self
  179.     {
  180.         $this->display_address $display_address;
  181.         return $this;
  182.     }
  183.     public function getEmail(): ?string
  184.     {
  185.         return $this->email;
  186.     }
  187.     public function setEmail(?string $email): self
  188.     {
  189.         $this->email $email;
  190.         return $this;
  191.     }
  192.     public function getPhone(): ?string
  193.     {
  194.         return $this->phone;
  195.     }
  196.     public function setPhone(?string $phone): self
  197.     {
  198.         $this->phone $phone;
  199.         return $this;
  200.     }
  201.     public function getAcceo(): ?string
  202.     {
  203.         return $this->acceo;
  204.     }
  205.     public function setAcceo(?string $acceo): self
  206.     {
  207.         $this->acceo $acceo;
  208.         return $this;
  209.     }
  210.     public function getLink1(): ?string
  211.     {
  212.         return $this->link_1;
  213.     }
  214.     public function setLink1(?string $link_1): self
  215.     {
  216.         $this->link_1 $link_1;
  217.         return $this;
  218.     }
  219.     public function getLink2(): ?string
  220.     {
  221.         return $this->link_2;
  222.     }
  223.     public function setLink2(?string $link_2): self
  224.     {
  225.         $this->link_2 $link_2;
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection|Post[]
  230.      */
  231.     public function getPosts(): Collection
  232.     {
  233.         return $this->posts;
  234.     }
  235.     public function addPost(Post $post): self
  236.     {
  237.         if (!$this->posts->contains($post)) {
  238.             $this->posts[] = $post;
  239.             $post->addContact($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removePost(Post $post): self
  244.     {
  245.         if ($this->posts->contains($post)) {
  246.             $this->posts->removeElement($post);
  247.             $post->removeContact($this);
  248.         }
  249.         return $this;
  250.     }
  251.     /**
  252.      * @return Collection|Post[]
  253.      */
  254.     public function getPosts1(): Collection
  255.     {
  256.         return $this->posts1;
  257.     }
  258.     public function addPosts1(Post $posts1): self
  259.     {
  260.         if (!$this->posts1->contains($posts1)) {
  261.             $this->posts1[] = $posts1;
  262.             $posts1->setContact1($this);
  263.         }
  264.         return $this;
  265.     }
  266.     public function removePosts1(Post $posts1): self
  267.     {
  268.         if ($this->posts1->contains($posts1)) {
  269.             $this->posts1->removeElement($posts1);
  270.             // set the owning side to null (unless already changed)
  271.             if ($posts1->getContact1() === $this) {
  272.                 $posts1->setContact1(null);
  273.             }
  274.         }
  275.         return $this;
  276.     }
  277.     /**
  278.      * @return Collection|Post[]
  279.      */
  280.     public function getPosts2(): Collection
  281.     {
  282.         return $this->posts2;
  283.     }
  284.     public function addPosts2(Post $posts2): self
  285.     {
  286.         if (!$this->posts2->contains($posts2)) {
  287.             $this->posts2[] = $posts2;
  288.             $posts2->setContact2($this);
  289.         }
  290.         return $this;
  291.     }
  292.     public function removePosts2(Post $posts2): self
  293.     {
  294.         if ($this->posts2->contains($posts2)) {
  295.             $this->posts2->removeElement($posts2);
  296.             // set the owning side to null (unless already changed)
  297.             if ($posts2->getContact2() === $this) {
  298.                 $posts2->setContact2(null);
  299.             }
  300.         }
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection|Post[]
  305.      */
  306.     public function getPosts3(): Collection
  307.     {
  308.         return $this->posts3;
  309.     }
  310.     public function addPosts3(Post $posts3): self
  311.     {
  312.         if (!$this->posts3->contains($posts3)) {
  313.             $this->posts3[] = $posts3;
  314.             $posts3->setContact3($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removePosts3(Post $posts3): self
  319.     {
  320.         if ($this->posts3->contains($posts3)) {
  321.             $this->posts3->removeElement($posts3);
  322.             // set the owning side to null (unless already changed)
  323.             if ($posts3->getContact3() === $this) {
  324.                 $posts3->setContact3(null);
  325.             }
  326.         }
  327.         return $this;
  328.     }
  329.     public function __toString(): string
  330.     {
  331.         $type '';
  332.         if ($this->getTypeContact() != null) {
  333.             $type $this->getTypeContact()->getName();
  334.         }
  335.         return $this->first_name ' ' $this->last_name ' - ' $type;
  336.     }
  337.     public function getCanton(): ?Cantons
  338.     {
  339.         return $this->canton;
  340.     }
  341.     public function setCanton(?Cantons $canton): self
  342.     {
  343.         $this->canton $canton;
  344.         return $this;
  345.     }
  346.     public function getRue(): ?string
  347.     {
  348.         return $this->rue;
  349.     }
  350.     public function setRue(?string $rue): self
  351.     {
  352.         $this->rue $rue;
  353.         return $this;
  354.     }
  355.     public function getCodePostal(): ?string
  356.     {
  357.         return $this->code_postal;
  358.     }
  359.     public function setCodePostal(?string $code_postal): self
  360.     {
  361.         $this->code_postal $code_postal;
  362.         return $this;
  363.     }
  364.     public function getVille(): ?string
  365.     {
  366.         return $this->ville;
  367.     }
  368.     public function setVille(?string $ville): self
  369.     {
  370.         $this->ville $ville;
  371.         return $this;
  372.     }
  373.     public function getLat(): ?string
  374.     {
  375.         return $this->lat;
  376.     }
  377.     public function setLat(?string $lat): self
  378.     {
  379.         $this->lat $lat;
  380.         return $this;
  381.     }
  382.     public function getLng(): ?string
  383.     {
  384.         return $this->lng;
  385.     }
  386.     public function setLng(?string $lng): self
  387.     {
  388.         $this->lng $lng;
  389.         return $this;
  390.     }
  391.     /**
  392.      * @return Collection|Pages[]
  393.      */
  394.     public function getPages(): Collection
  395.     {
  396.         return $this->pages;
  397.     }
  398.     public function addPage(Pages $page): self
  399.     {
  400.         if (!$this->pages->contains($page)) {
  401.             $this->pages[] = $page;
  402.             $page->setContact1($this);
  403.         }
  404.         return $this;
  405.     }
  406.     public function removePage(Pages $page): self
  407.     {
  408.         if ($this->pages->contains($page)) {
  409.             $this->pages->removeElement($page);
  410.             // set the owning side to null (unless already changed)
  411.             if ($page->getContact1() === $this) {
  412.                 $page->setContact1(null);
  413.             }
  414.         }
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return Collection|Pages[]
  419.      */
  420.     public function getPages2(): Collection
  421.     {
  422.         return $this->pages2;
  423.     }
  424.     public function addPages2(Pages $pages2): self
  425.     {
  426.         if (!$this->pages2->contains($pages2)) {
  427.             $this->pages2[] = $pages2;
  428.             $pages2->setContact2($this);
  429.         }
  430.         return $this;
  431.     }
  432.     public function removePages2(Pages $pages2): self
  433.     {
  434.         if ($this->pages2->contains($pages2)) {
  435.             $this->pages2->removeElement($pages2);
  436.             // set the owning side to null (unless already changed)
  437.             if ($pages2->getContact2() === $this) {
  438.                 $pages2->setContact2(null);
  439.             }
  440.         }
  441.         return $this;
  442.     }
  443.     /**
  444.      * @return Collection|Pages[]
  445.      */
  446.     public function getPages3(): Collection
  447.     {
  448.         return $this->pages3;
  449.     }
  450.     public function addPages3(Pages $pages3): self
  451.     {
  452.         if (!$this->pages3->contains($pages3)) {
  453.             $this->pages3[] = $pages3;
  454.             $pages3->setContact3($this);
  455.         }
  456.         return $this;
  457.     }
  458.     public function removePages3(Pages $pages3): self
  459.     {
  460.         if ($this->pages3->contains($pages3)) {
  461.             $this->pages3->removeElement($pages3);
  462.             // set the owning side to null (unless already changed)
  463.             if ($pages3->getContact3() === $this) {
  464.                 $pages3->setContact3(null);
  465.             }
  466.         }
  467.         return $this;
  468.     }
  469.     public function getTypeContact(): ?TypeContact
  470.     {
  471.         return $this->type_contact;
  472.     }
  473.     public function setTypeContact(?TypeContact $type_contact): self
  474.     {
  475.         $this->type_contact $type_contact;
  476.         return $this;
  477.     }
  478.     public function getType(): ?string
  479.     {
  480.         return $this->type;
  481.     }
  482.     public function setType(?string $type): self
  483.     {
  484.         $this->type $type;
  485.         return $this;
  486.     }
  487.     public function getSlug(): ?string
  488.     {
  489.         return $this->slug;
  490.     }
  491.     public function setSlug(?string $slug): self
  492.     {
  493.         $this->slug $slug;
  494.         return $this;
  495.     }
  496.     public function getDateUpdate(): ?\DateTimeInterface
  497.     {
  498.         return $this->date_update;
  499.     }
  500.     public function setDateUpdate(?\DateTimeInterface $date_update): self
  501.     {
  502.         $this->date_update $date_update;
  503.         return $this;
  504.     }
  505.     public function getActive(): ?bool
  506.     {
  507.         return $this->active;
  508.     }
  509.     public function setActive(?bool $active): self
  510.     {
  511.         $this->active $active;
  512.         return $this;
  513.     }
  514.     /**
  515.      * @return Collection|Citation[]
  516.      */
  517.     public function getCitations(): Collection
  518.     {
  519.         return $this->citations;
  520.     }
  521.     public function addCitation(Citation $citation): self
  522.     {
  523.         if (!$this->citations->contains($citation)) {
  524.             $this->citations[] = $citation;
  525.             $citation->setElu($this);
  526.         }
  527.         return $this;
  528.     }
  529.     public function removeCitation(Citation $citation): self
  530.     {
  531.         if ($this->citations->removeElement($citation)) {
  532.             // set the owning side to null (unless already changed)
  533.             if ($citation->getElu() === $this) {
  534.                 $citation->setElu(null);
  535.             }
  536.         }
  537.         return $this;
  538.     }
  539.     /**
  540.      * @return Collection|PolitiqueDepartementale[]
  541.      */
  542.     public function getPolitiqueDepartementales(): Collection
  543.     {
  544.         return $this->politiqueDepartementales;
  545.     }
  546.     public function addPolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
  547.     {
  548.         if (!$this->politiqueDepartementales->contains($politiqueDepartementale)) {
  549.             $this->politiqueDepartementales[] = $politiqueDepartementale;
  550.             $politiqueDepartementale->addContact($this);
  551.         }
  552.         return $this;
  553.     }
  554.     public function removePolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
  555.     {
  556.         if ($this->politiqueDepartementales->removeElement($politiqueDepartementale)) {
  557.             $politiqueDepartementale->removeContact($this);
  558.         }
  559.         return $this;
  560.     }
  561.     public function getCivilite(): ?string
  562.     {
  563.         return $this->civilite;
  564.     }
  565.     public function setCivilite(?string $civilite): self
  566.     {
  567.         $this->civilite $civilite;
  568.         return $this;
  569.     }
  570.     /**
  571.      * @return Collection<int, PageSatellite>
  572.      */
  573.     public function getPageSatellites(): Collection
  574.     {
  575.         return $this->pageSatellites;
  576.     }
  577.     public function addPageSatellite(PageSatellite $pageSatellite): self
  578.     {
  579.         if (!$this->pageSatellites->contains($pageSatellite)) {
  580.             $this->pageSatellites->add($pageSatellite);
  581.             $pageSatellite->addContact($this);
  582.         }
  583.         return $this;
  584.     }
  585.     public function removePageSatellite(PageSatellite $pageSatellite): self
  586.     {
  587.         if ($this->pageSatellites->removeElement($pageSatellite)) {
  588.             $pageSatellite->removeContact($this);
  589.         }
  590.         return $this;
  591.     }
  592. }