<?php
namespace App\Entity;
use App\Repository\FoodtruckRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FoodtruckRepository::class)]
class Foodtruck
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string',length: 255)]
private $libelle;
#[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Preparation::class)]
private $preparations;
#[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Service::class, orphanRemoval: true)]
private $services;
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'foodtrucks')]
private $users;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $url;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $logo;
#[ORM\Column(type: 'string', length: 180, unique: true)]
private $email;
#[ORM\Column(type: 'string', length: 180, nullable: true)]
private $phone_number;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private $qrcode;
#[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Rotation::class, orphanRemoval: true)]
private Collection $rotations;
#[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Terminal::class, orphanRemoval: true)]
private Collection $terminals;
#[ORM\Column(length: 255, nullable: true)]
private ?string $formeJuridique = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $cp = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ville = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $siret = null;
#[ORM\Column(nullable: true)]
private ?bool $tva = null;
#[ORM\Column(nullable: true)]
private ?int $prochainIndexCommande = 1;
public function __construct()
{
$this->preparations = new ArrayCollection();
$this->services = new ArrayCollection();
$this->users = new ArrayCollection();
$this->rotations = new ArrayCollection();
$this->terminals = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
/**
* @return Collection<int, Preparation>
*/
public function getPreparations(): Collection
{
return $this->preparations;
}
public function addPreparation(Preparation $preparation): self
{
if (!$this->preparations->contains($preparation)) {
$this->preparations->add($preparation);
$preparation->setFoodtruck($this);
}
return $this;
}
public function removePreparation(Preparation $preparation): self
{
if ($this->preparations->removeElement($preparation)) {
// set the owning side to null (unless already changed)
if ($preparation->getFoodtruck() === $this) {
$preparation->setFoodtruck(null);
}
}
return $this;
}
/**
* @return Collection<int, Service>
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Service $service): self
{
if (!$this->services->contains($service)) {
$this->services->add($service);
$service->setFoodtruck($this);
}
return $this;
}
public function removeService(Service $service): self
{
if ($this->services->removeElement($service)) {
// set the owning side to null (unless already changed)
if ($service->getFoodtruck() === $this) {
$service->setFoodtruck(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users->add($user);
}
return $this;
}
public function removeUser(User $user): self
{
$this->users->removeElement($user);
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->phone_number;
}
public function setPhoneNumber(?string $phone_number): self
{
$this->phone_number = $phone_number;
return $this;
}
public function getQrcode(): ?string
{
return $this->qrcode;
}
public function setQrcode(?string $qrcode): self
{
$this->qrcode = $qrcode;
return $this;
}
/**
* @return Collection<int, Rotation>
*/
public function getRotations(): Collection
{
return $this->rotations;
}
public function addRotation(Rotation $rotation): self
{
if (!$this->rotations->contains($rotation)) {
$this->rotations->add($rotation);
$rotation->setFoodtruck($this);
}
return $this;
}
public function removeRotation(Rotation $rotation): self
{
if ($this->rotations->removeElement($rotation)) {
// set the owning side to null (unless already changed)
if ($rotation->getFoodtruck() === $this) {
$rotation->setFoodtruck(null);
}
}
return $this;
}
/**
* @return Collection<int, Terminal>
*/
public function getTerminals(): Collection
{
return $this->terminals;
}
public function addTerminal(Terminal $terminal): static
{
if (!$this->terminals->contains($terminal)) {
$this->terminals->add($terminal);
$terminal->setFoodtruck($this);
}
return $this;
}
public function removeTerminal(Terminal $terminal): static
{
if ($this->terminals->removeElement($terminal)) {
// set the owning side to null (unless already changed)
if ($terminal->getFoodtruck() === $this) {
$terminal->setFoodtruck(null);
}
}
return $this;
}
public function getFormeJuridique(): ?string
{
return $this->formeJuridique;
}
public function setFormeJuridique(?string $formeJuridique): static
{
$this->formeJuridique = $formeJuridique;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): static
{
$this->adresse = $adresse;
return $this;
}
public function getCp(): ?string
{
return $this->cp;
}
public function setCp(?string $cp): static
{
$this->cp = $cp;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): static
{
$this->ville = $ville;
return $this;
}
public function getSiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): static
{
$this->siret = $siret;
return $this;
}
public function isTva(): ?bool
{
return $this->tva;
}
public function setTva(?bool $tva): static
{
$this->tva = $tva;
return $this;
}
public function getProchainIndexCommande(): ?int
{
return $this->prochainIndexCommande;
}
public function setProchainIndexCommande(?int $prochainIndexCommande): static
{
$this->prochainIndexCommande = $prochainIndexCommande;
return $this;
}
}