<?php
namespace App\Entity;
use App\Entity\Variables\Equipment;
use App\Repository\DeliveryManRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DeliveryManRepository::class)
*/
class DeliveryMan extends User
{
protected string $discr = 'deliveryMan';
/**
* @ORM\ManyToMany(targetEntity=Delivery::class, mappedBy="deliveryMen", orphanRemoval=true, cascade={"persist"})
*
* @var Collection<int, Delivery>
*/
private Collection $deliveries;
/**
* @ORM\OneToMany(targetEntity=Sector::class, mappedBy="deliveryMan", orphanRemoval=true, cascade={"persist"})
*
* @var Collection<int, Sector>
*/
private Collection $sectors;
/**
* @ORM\OneToMany(targetEntity=Document::class, mappedBy="deliveryMan", orphanRemoval=true, cascade={"persist"})
*
* @var Collection<int, Document>
*/
private Collection $documents;
/**
* @ORM\ManyToOne(targetEntity=Vehicle::class)
*/
private Vehicle $vehicle;
/**
* @ORM\Column(type="boolean")
*/
protected bool $isHeavy = false;
/**
* @ORM\ManyToOne(targetEntity=VehicleType::class)
*/
private ?VehicleType $vehicleType = null;
/**
* @ORM\OneToMany(targetEntity=Course::class, mappedBy="deliveryMan")
*
* @var Collection<int, Course>
*/
private Collection $courses;
/**
* @ORM\OneToOne(targetEntity=Tracking::class, cascade={"persist", "remove"})
*/
private ?Tracking $lastPosition;
/**
* @ORM\OneToMany(targetEntity=CourseProposal::class, mappedBy="deliveryMan")
*
* @var Collection<int, CourseProposal>
*/
private Collection $courseProposals;
/**
* @ORM\OneToMany(targetEntity=DeliveryManStatement::class, mappedBy="deliveryMan", orphanRemoval=true)
*
* @var Collection<int, DeliveryManStatement>
*/
private Collection $deliveryManStatements;
/**
* @ORM\ManyToMany(targetEntity=Equipment::class, inversedBy="deliveryMen")
*
* @var Collection<int, Equipment>
*/
private Collection $equipments;
/**
* @ORM\OneToMany(targetEntity=DeliveryManContract::class, mappedBy="deliveryMan", orphanRemoval=true)
*
* @var Collection<int, DeliveryManContract>
*/
private Collection $deliveryManContracts;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $signature;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private ?string $barCode;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $controlString;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $socialReason;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $siret;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $siren;
// /**
// * @ORM\Column(type="float", nullable=true)
// */
// private $accountBalance;
public function __construct()
{
parent::__construct();
$this->deliveries = new ArrayCollection();
$this->sectors = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->courses = new ArrayCollection();
$this->courseProposals = new ArrayCollection();
$this->deliveryManStatements = new ArrayCollection();
$this->equipments = new ArrayCollection();
$this->deliveryManContracts = new ArrayCollection();
}
/**
* @return Collection<int, Delivery>
*/
public function getDeliveries(): Collection
{
return $this->deliveries;
}
public function addDelivery(Delivery $delivery): self
{
if (!$this->deliveries->contains($delivery)) {
$this->deliveries[] = $delivery;
$delivery->addDeliveryMan($this);
}
return $this;
}
public function removeDelivery(Delivery $delivery): self
{
if ($this->deliveries->removeElement($delivery)) {
$delivery->removeDeliveryMan($this);
}
return $this;
}
/**
* @return Collection<int, Sector>
*/
public function getSectors(): Collection
{
return $this->sectors;
}
public function addSector(Sector $sector): self
{
if (!$this->sectors->contains($sector)) {
$this->sectors[] = $sector;
$sector->setDeliveryMan($this);
}
return $this;
}
public function removeSector(Sector $sector): self
{
$this->sectors->removeElement($sector);
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setDeliveryMan($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getDeliveryMan() === $this) {
$document->setDeliveryMan(null);
}
}
return $this;
}
public function removeAllDocuments(): self
{
foreach ($this->documents as $document) {
$this->removeDocument($document);
}
return $this;
}
public function getVehicle(): ?Vehicle
{
return $this->vehicle;
}
public function getDiscr(): ?string
{
return $this->discr;
}
public function setVehicle(Vehicle $vehicle): self
{
$this->vehicle = $vehicle;
return $this;
}
/**
* Get the value of plainPassword.
*/
public function getPlainPassword(): ?string
{
return $this->plainPassword;
}
/**
* Set the value of plainPassword.
*
* @return self
*/
public function setPlainPassword(?string $plainPassword)
{
$this->plainPassword = $plainPassword;
return $this;
}
/**
* Get the value of isHeavy.
*/
public function isHeavy(): bool
{
return $this->isHeavy;
}
/**
* Set the value of isHeavy.
*
* @return self
*/
public function setIsHeavy(bool $isHeavy)
{
$this->isHeavy = $isHeavy;
return $this;
}
/**
* Get the value of vehicleType.
*/
public function getVehicleType(): ?VehicleType
{
return $this->vehicleType;
}
/**
* Set the value of vehicleType.
*
* @return self
*/
public function setVehicleType(?VehicleType $vehicleType)
{
$this->vehicleType = $vehicleType;
return $this;
}
/**
* @return Collection<int, Course>
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses[] = $course;
$course->setDeliveryMan($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
$this->courses->removeElement($course);
return $this;
}
public function getLastPosition(): ?Tracking
{
return $this->lastPosition;
}
public function setLastPosition(?Tracking $lastPosition): self
{
$this->lastPosition = $lastPosition;
return $this;
}
/**
* @return Collection<int, CourseProposal>
*/
public function getCourseProposals(): Collection
{
return $this->courseProposals;
}
public function addCourseProposal(CourseProposal $courseProposal): self
{
if (!$this->courseProposals->contains($courseProposal)) {
$this->courseProposals[] = $courseProposal;
$courseProposal->setDeliveryMan($this);
}
return $this;
}
/**
* @return Collection<int, DeliveryManStatement>
*/
public function getDeliveryManStatements(): Collection
{
return $this->deliveryManStatements;
}
public function addDeliveryManStatement(DeliveryManStatement $deliveryManStatement): self
{
if (!$this->deliveryManStatements->contains($deliveryManStatement)) {
$this->deliveryManStatements[] = $deliveryManStatement;
$deliveryManStatement->setDeliveryMan($this);
}
return $this;
}
public function removeCourseProposal(CourseProposal $courseProposal): self
{
$this->courseProposals->removeElement($courseProposal);
return $this;
}
public function removeDeliveryManStatement(DeliveryManStatement $deliveryManStatement): self
{
$this->deliveryManStatements->removeElement($deliveryManStatement);
return $this;
}
/**
* @return Collection<int, Equipment>
*/
public function getEquipments(): Collection
{
return $this->equipments;
}
public function addEquipment(Equipment $equipment): self
{
if (!$this->equipments->contains($equipment)) {
$this->equipments[] = $equipment;
}
return $this;
}
public function removeEquipment(Equipment $equipment): self
{
$this->equipments->removeElement($equipment);
return $this;
}
/**
* @return Collection<int, DeliveryManContract>
*/
public function getDeliveryManContracts(): Collection
{
return $this->deliveryManContracts;
}
public function addDeliveryManContract(DeliveryManContract $deliveryManContract): self
{
if (!$this->deliveryManContracts->contains($deliveryManContract)) {
$this->deliveryManContracts[] = $deliveryManContract;
$deliveryManContract->setDeliveryMan($this);
}
return $this;
}
public function removeDeliveryManContract(DeliveryManContract $deliveryManContract): self
{
$this->deliveryManContracts->removeElement($deliveryManContract);
return $this;
}
public function getSignature(): ?string
{
return $this->signature;
}
public function setSignature(?string $signature): self
{
$this->signature = $signature;
return $this;
}
public function getBarCode(): ?string
{
return $this->barCode;
}
public function setBarCode(?string $barCode): self
{
$this->barCode = $barCode;
return $this;
}
public function getControlString(): ?string
{
return $this->controlString;
}
public function setControlString(?string $controlString): self
{
$this->controlString = $controlString;
return $this;
}
public function getSocialReason(): ?string
{
return $this->socialReason;
}
public function setSocialReason(?string $socialReason): self
{
$this->socialReason = $socialReason;
return $this;
}
public function getsiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): self
{
$this->siret = $siret;
return $this;
}
public function getSiren(): ?string
{
return $this->siren;
}
public function setSiren(?string $siren): self
{
$this->siren = $siren;
return $this;
}
}