<?php
namespace App\Entity;
use App\Repository\LieuRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LieuRepository::class)]
class Lieu
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $codepostal = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ville = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $latitude = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $longitude = null;
#[ORM\OneToMany(mappedBy: 'lieu_new', targetEntity: Post::class)]
private Collection $posts;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $openagenda_id = null;
public function __construct()
{
$this->posts = new ArrayCollection();
}
public function __toString()
{
return $this->name.' '.$this->ville;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): static
{
$this->adresse = $adresse;
return $this;
}
public function getCodepostal(): ?string
{
return $this->codepostal;
}
public function setCodepostal(?string $codepostal): static
{
$this->codepostal = $codepostal;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): static
{
$this->ville = $ville;
return $this;
}
public function getLatitude(): ?string
{
return $this->latitude;
}
public function setLatitude(?string $latitude): static
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?string
{
return $this->longitude;
}
public function setLongitude(?string $longitude): static
{
$this->longitude = $longitude;
return $this;
}
/**
* @return Collection<int, Post>
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): static
{
if (!$this->posts->contains($post)) {
$this->posts->add($post);
$post->setLieuNew($this);
}
return $this;
}
public function removePost(Post $post): static
{
if ($this->posts->removeElement($post)) {
// set the owning side to null (unless already changed)
if ($post->getLieuNew() === $this) {
$post->setLieuNew(null);
}
}
return $this;
}
public function getOpenagendaId(): ?string
{
return $this->openagenda_id;
}
public function setOpenagendaId(?string $openagenda_id): static
{
$this->openagenda_id = $openagenda_id;
return $this;
}
}