suppr table ville
This commit is contained in:
@@ -28,16 +28,18 @@ class Lieu
|
|||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?float $longitude = null;
|
private ?float $longitude = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $ville = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'integer')]
|
||||||
|
private ?int $codePostal = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Sortie>
|
* @var Collection<int, Sortie>
|
||||||
*/
|
*/
|
||||||
#[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'lieu')]
|
#[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'lieu')]
|
||||||
private Collection $sorties;
|
private Collection $sorties;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'lieux')]
|
|
||||||
#[ORM\JoinColumn(name: 'ville_id', referencedColumnName: 'id_ville', nullable: false)]
|
|
||||||
private ?Ville $ville = null;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->sorties = new ArrayCollection();
|
$this->sorties = new ArrayCollection();
|
||||||
@@ -96,6 +98,30 @@ class Lieu
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getVille(): ?string
|
||||||
|
{
|
||||||
|
return $this->ville;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVille(string $ville): self
|
||||||
|
{
|
||||||
|
$this->ville = $ville;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCodePostal(): ?int
|
||||||
|
{
|
||||||
|
return $this->codePostal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCodePostal(int $codePostal): self
|
||||||
|
{
|
||||||
|
$this->codePostal = $codePostal;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Sortie>
|
* @return Collection<int, Sortie>
|
||||||
*/
|
*/
|
||||||
@@ -125,18 +151,4 @@ class Lieu
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVille(): ?Ville
|
|
||||||
{
|
|
||||||
return $this->ville;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setVille(?Ville $ville): self
|
|
||||||
{
|
|
||||||
$this->ville = $ville;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\VilleRepository;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: VilleRepository::class)]
|
|
||||||
class Ville
|
|
||||||
{
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\Column(type: 'guid', unique: true)]
|
|
||||||
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
||||||
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
|
||||||
private ?string $idVille = null;
|
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
|
||||||
private ?string $nom = null;
|
|
||||||
|
|
||||||
#[ORM\Column(nullable: true)]
|
|
||||||
private ?int $codePostal = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Collection<int, Lieu>
|
|
||||||
*/
|
|
||||||
#[ORM\OneToMany(targetEntity: Lieu::class, mappedBy: 'ville')]
|
|
||||||
private Collection $lieux;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->lieux = new ArrayCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIdVille(): ?string
|
|
||||||
{
|
|
||||||
return $this->idVille;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNom(): ?string
|
|
||||||
{
|
|
||||||
return $this->nom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setNom(string $nom): self
|
|
||||||
{
|
|
||||||
$this->nom = $nom;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCodePostal(): ?int
|
|
||||||
{
|
|
||||||
return $this->codePostal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCodePostal(?int $codePostal): self
|
|
||||||
{
|
|
||||||
$this->codePostal = $codePostal;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int, Lieu>
|
|
||||||
*/
|
|
||||||
public function getLieux(): Collection
|
|
||||||
{
|
|
||||||
return $this->lieux;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addLieu(Lieu $lieu): self
|
|
||||||
{
|
|
||||||
if (!$this->lieux->contains($lieu)) {
|
|
||||||
$this->lieux->add($lieu);
|
|
||||||
$lieu->setVille($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeLieu(Lieu $lieu): self
|
|
||||||
{
|
|
||||||
if ($this->lieux->removeElement($lieu)) {
|
|
||||||
// Set the owning side to null (unless already changed)
|
|
||||||
if ($lieu->getVille() === $this) {
|
|
||||||
$lieu->setVille(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -54,14 +54,6 @@ class SortieType extends AbstractType
|
|||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'form-control'],
|
'attr' => ['class' => 'form-control'],
|
||||||
])
|
])
|
||||||
->add('ville', EntityType::class, [
|
|
||||||
'class' => Ville::class,
|
|
||||||
'choice_label' => 'nom',
|
|
||||||
'mapped' => false,
|
|
||||||
'label' => 'Ville',
|
|
||||||
'placeholder' => 'Sélectionnez une ville',
|
|
||||||
'attr' => ['id' => 'ville-select'],
|
|
||||||
])
|
|
||||||
->add('lieu', EntityType::class, [
|
->add('lieu', EntityType::class, [
|
||||||
'class' => Lieu::class,
|
'class' => Lieu::class,
|
||||||
'choice_label' => 'nom',
|
'choice_label' => 'nom',
|
||||||
|
|||||||
Reference in New Issue
Block a user