<?php
namespace App\Entity;
use App\Repository\ParkRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\TimestampableTrait;
/**
* @ORM\Entity(repositoryClass=ParkRepository::class)
*/
class Park
{
use TimestampableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Transporteur::class, inversedBy="parks")
* @ORM\JoinColumn(nullable=false)
*/
private $transporteur;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $address;
/**
* @ORM\Column(type="string", length=255)
*/
private $postalCode;
/**
* @ORM\Column(type="string", length=255)
*/
private $city;
/**
* @ORM\Column(type="string", length=255)
*/
private $country;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lat;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lon;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $distance;
/**
* @ORM\OneToMany(targetEntity=Vehicle::class, mappedBy="park")
*/
private $vehicles;
/**
* @ORM\OneToMany(targetEntity=Collaborateur::class, mappedBy="park")
*/
private $collaborateurs;
public function __construct()
{
$this->vehicles = new ArrayCollection();
$this->collaborateurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTransporteur(): ?Transporteur
{
return $this->transporteur;
}
public function setTransporteur(?Transporteur $transporteur): self
{
$this->transporteur = $transporteur;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): self
{
$this->country = $country;
return $this;
}
public function getLat(): ?string
{
return $this->lat;
}
public function setLat(?string $lat): self
{
$this->lat = $lat;
return $this;
}
public function getLon(): ?string
{
return $this->lon;
}
public function setLon(?string $lon): self
{
$this->lon = $lon;
return $this;
}
public function getDistance(): ?string
{
return $this->distance;
}
public function setDistance(?string $distance): self
{
$this->distance = $distance;
return $this;
}
/**
* @return Collection<int, Vehicle>
*/
public function getVehicles(): Collection
{
return $this->vehicles;
}
public function addVehicle(Vehicle $vehicle): self
{
if (!$this->vehicles->contains($vehicle)) {
$this->vehicles[] = $vehicle;
$vehicle->setPark($this);
}
return $this;
}
public function removeVehicle(Vehicle $vehicle): self
{
if ($this->vehicles->removeElement($vehicle)) {
// set the owning side to null (unless already changed)
if ($vehicle->getPark() === $this) {
$vehicle->setPark(null);
}
}
return $this;
}
/**
* @return Collection<int, Collaborateur>
*/
public function getCollaborateurs(): Collection
{
return $this->collaborateurs;
}
public function addCollaborateur(Collaborateur $collaborateur): self
{
if (!$this->collaborateurs->contains($collaborateur)) {
$this->collaborateurs[] = $collaborateur;
$collaborateur->setPark($this);
}
return $this;
}
public function removeCollaborateur(Collaborateur $collaborateur): self
{
if ($this->collaborateurs->removeElement($collaborateur)) {
// set the owning side to null (unless already changed)
if ($collaborateur->getPark() === $this) {
$collaborateur->setPark(null);
}
}
return $this;
}
}