<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: \App\Repository\ContactRepository::class)]
class Contact implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $first_name= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $last_name= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $picture= null;
/**
* @Vich\UploadableField(mapping="images", fileNameProperty="picture")
*/
private ?\Symfony\Component\HttpFoundation\File\File $picture_file = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $short_description= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $long_description= null;
#[ORM\ManyToOne(targetEntity: \App\Entity\Territory::class, inversedBy: 'contacts')]
private mixed $territory;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $display_address= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $email= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $phone= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $acceo= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $link_1= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $link_2= null;
#[ORM\ManyToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'contacts', cascade: ['persist', 'remove'])]
private mixed $posts;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'contact1', cascade: ['persist', 'remove'])]
private mixed $posts1;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'contact2', cascade: ['persist', 'remove'])]
private mixed $posts2;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'contact3', cascade: ['persist', 'remove'])]
private mixed $posts3;
#[ORM\ManyToOne(targetEntity: \App\Entity\Cantons::class, inversedBy: 'contacts', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(onDelete: 'SET NULL')]
private mixed $canton;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $rue= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $code_postal= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $ville= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $lat= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $lng= null;
#[ORM\OneToMany(targetEntity: \App\Entity\Pages::class, mappedBy: 'contact1')]
private mixed $pages;
#[ORM\OneToMany(targetEntity: \App\Entity\Pages::class, mappedBy: 'contact2')]
private mixed $pages2;
#[ORM\OneToMany(targetEntity: \App\Entity\Pages::class, mappedBy: 'contact3')]
private mixed $pages3;
#[ORM\ManyToOne(targetEntity: \App\Entity\TypeContact::class, inversedBy: 'contacts')]
private mixed $type_contact;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $type= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $slug= null;
#[ORM\Column(type: 'datetime', nullable: true)]
private $date_update;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $active;
#[ORM\OneToMany(targetEntity: Citation::class, mappedBy: 'elu')]
private mixed $citations;
#[ORM\ManyToMany(targetEntity: PolitiqueDepartementale::class, mappedBy: 'contacts')]
private mixed $politiqueDepartementales;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $civilite= null;
#[ORM\ManyToMany(targetEntity: PageSatellite::class, mappedBy: 'contacts')]
private Collection $pageSatellites;
public function __construct()
{
$this->posts = new ArrayCollection();
$this->posts1 = new ArrayCollection();
$this->posts2 = new ArrayCollection();
$this->posts3 = new ArrayCollection();
$this->pages = new ArrayCollection();
$this->pages2 = new ArrayCollection();
$this->pages3 = new ArrayCollection();
$this->citations = new ArrayCollection();
$this->politiqueDepartementales = new ArrayCollection();
$this->pageSatellites = new ArrayCollection();
}
public function setPictureFile(File $file = null): void
{
$this->picture_file = $file;
if ($file) {
$date_update = new \DateTime('now');
$this->date_update = $date_update;
}
}
public function getPictureFile(): mixed
{
return $this->picture_file;
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->first_name;
}
public function setFirstName(?string $first_name): self
{
$this->first_name = $first_name;
return $this;
}
public function getLastName(): ?string
{
return $this->last_name;
}
public function setLastName(?string $last_name): self
{
$this->last_name = $last_name;
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(?string $picture): self
{
$this->picture = $picture;
return $this;
}
public function getShortDescription(): ?string
{
return $this->short_description;
}
public function setShortDescription(?string $short_description): self
{
$this->short_description = $short_description;
return $this;
}
public function getLongDescription(): ?string
{
return $this->long_description;
}
public function setLongDescription(?string $long_description): self
{
$this->long_description = $long_description;
return $this;
}
public function getTerritory(): ?Territory
{
return $this->territory;
}
public function setTerritory(?Territory $territory): self
{
$this->territory = $territory;
return $this;
}
public function getDisplayAddress(): ?string
{
return $this->display_address;
}
public function setDisplayAddress(?string $display_address): self
{
$this->display_address = $display_address;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getAcceo(): ?string
{
return $this->acceo;
}
public function setAcceo(?string $acceo): self
{
$this->acceo = $acceo;
return $this;
}
public function getLink1(): ?string
{
return $this->link_1;
}
public function setLink1(?string $link_1): self
{
$this->link_1 = $link_1;
return $this;
}
public function getLink2(): ?string
{
return $this->link_2;
}
public function setLink2(?string $link_2): self
{
$this->link_2 = $link_2;
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->addContact($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
$post->removeContact($this);
}
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts1(): Collection
{
return $this->posts1;
}
public function addPosts1(Post $posts1): self
{
if (!$this->posts1->contains($posts1)) {
$this->posts1[] = $posts1;
$posts1->setContact1($this);
}
return $this;
}
public function removePosts1(Post $posts1): self
{
if ($this->posts1->contains($posts1)) {
$this->posts1->removeElement($posts1);
// set the owning side to null (unless already changed)
if ($posts1->getContact1() === $this) {
$posts1->setContact1(null);
}
}
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts2(): Collection
{
return $this->posts2;
}
public function addPosts2(Post $posts2): self
{
if (!$this->posts2->contains($posts2)) {
$this->posts2[] = $posts2;
$posts2->setContact2($this);
}
return $this;
}
public function removePosts2(Post $posts2): self
{
if ($this->posts2->contains($posts2)) {
$this->posts2->removeElement($posts2);
// set the owning side to null (unless already changed)
if ($posts2->getContact2() === $this) {
$posts2->setContact2(null);
}
}
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts3(): Collection
{
return $this->posts3;
}
public function addPosts3(Post $posts3): self
{
if (!$this->posts3->contains($posts3)) {
$this->posts3[] = $posts3;
$posts3->setContact3($this);
}
return $this;
}
public function removePosts3(Post $posts3): self
{
if ($this->posts3->contains($posts3)) {
$this->posts3->removeElement($posts3);
// set the owning side to null (unless already changed)
if ($posts3->getContact3() === $this) {
$posts3->setContact3(null);
}
}
return $this;
}
public function __toString(): string
{
$type = '';
if ($this->getTypeContact() != null) {
$type = $this->getTypeContact()->getName();
}
return $this->first_name . ' ' . $this->last_name . ' - ' . $type;
}
public function getCanton(): ?Cantons
{
return $this->canton;
}
public function setCanton(?Cantons $canton): self
{
$this->canton = $canton;
return $this;
}
public function getRue(): ?string
{
return $this->rue;
}
public function setRue(?string $rue): self
{
$this->rue = $rue;
return $this;
}
public function getCodePostal(): ?string
{
return $this->code_postal;
}
public function setCodePostal(?string $code_postal): self
{
$this->code_postal = $code_postal;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getLat(): ?string
{
return $this->lat;
}
public function setLat(?string $lat): self
{
$this->lat = $lat;
return $this;
}
public function getLng(): ?string
{
return $this->lng;
}
public function setLng(?string $lng): self
{
$this->lng = $lng;
return $this;
}
/**
* @return Collection|Pages[]
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Pages $page): self
{
if (!$this->pages->contains($page)) {
$this->pages[] = $page;
$page->setContact1($this);
}
return $this;
}
public function removePage(Pages $page): self
{
if ($this->pages->contains($page)) {
$this->pages->removeElement($page);
// set the owning side to null (unless already changed)
if ($page->getContact1() === $this) {
$page->setContact1(null);
}
}
return $this;
}
/**
* @return Collection|Pages[]
*/
public function getPages2(): Collection
{
return $this->pages2;
}
public function addPages2(Pages $pages2): self
{
if (!$this->pages2->contains($pages2)) {
$this->pages2[] = $pages2;
$pages2->setContact2($this);
}
return $this;
}
public function removePages2(Pages $pages2): self
{
if ($this->pages2->contains($pages2)) {
$this->pages2->removeElement($pages2);
// set the owning side to null (unless already changed)
if ($pages2->getContact2() === $this) {
$pages2->setContact2(null);
}
}
return $this;
}
/**
* @return Collection|Pages[]
*/
public function getPages3(): Collection
{
return $this->pages3;
}
public function addPages3(Pages $pages3): self
{
if (!$this->pages3->contains($pages3)) {
$this->pages3[] = $pages3;
$pages3->setContact3($this);
}
return $this;
}
public function removePages3(Pages $pages3): self
{
if ($this->pages3->contains($pages3)) {
$this->pages3->removeElement($pages3);
// set the owning side to null (unless already changed)
if ($pages3->getContact3() === $this) {
$pages3->setContact3(null);
}
}
return $this;
}
public function getTypeContact(): ?TypeContact
{
return $this->type_contact;
}
public function setTypeContact(?TypeContact $type_contact): self
{
$this->type_contact = $type_contact;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getDateUpdate(): ?\DateTimeInterface
{
return $this->date_update;
}
public function setDateUpdate(?\DateTimeInterface $date_update): self
{
$this->date_update = $date_update;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(?bool $active): self
{
$this->active = $active;
return $this;
}
/**
* @return Collection|Citation[]
*/
public function getCitations(): Collection
{
return $this->citations;
}
public function addCitation(Citation $citation): self
{
if (!$this->citations->contains($citation)) {
$this->citations[] = $citation;
$citation->setElu($this);
}
return $this;
}
public function removeCitation(Citation $citation): self
{
if ($this->citations->removeElement($citation)) {
// set the owning side to null (unless already changed)
if ($citation->getElu() === $this) {
$citation->setElu(null);
}
}
return $this;
}
/**
* @return Collection|PolitiqueDepartementale[]
*/
public function getPolitiqueDepartementales(): Collection
{
return $this->politiqueDepartementales;
}
public function addPolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
{
if (!$this->politiqueDepartementales->contains($politiqueDepartementale)) {
$this->politiqueDepartementales[] = $politiqueDepartementale;
$politiqueDepartementale->addContact($this);
}
return $this;
}
public function removePolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
{
if ($this->politiqueDepartementales->removeElement($politiqueDepartementale)) {
$politiqueDepartementale->removeContact($this);
}
return $this;
}
public function getCivilite(): ?string
{
return $this->civilite;
}
public function setCivilite(?string $civilite): self
{
$this->civilite = $civilite;
return $this;
}
/**
* @return Collection<int, PageSatellite>
*/
public function getPageSatellites(): Collection
{
return $this->pageSatellites;
}
public function addPageSatellite(PageSatellite $pageSatellite): self
{
if (!$this->pageSatellites->contains($pageSatellite)) {
$this->pageSatellites->add($pageSatellite);
$pageSatellite->addContact($this);
}
return $this;
}
public function removePageSatellite(PageSatellite $pageSatellite): self
{
if ($this->pageSatellites->removeElement($pageSatellite)) {
$pageSatellite->removeContact($this);
}
return $this;
}
}