src/Flexy/Apps/TransportBundle/Entity/Mission.php line 25
<?php
namespace App\Flexy\Apps\TransportBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Customer\CustomerGroup;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\ShopBundle\Entity\Resource\Agent;
use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
use App\Flexy\ShopBundle\Entity\Shipping\ShipmentItem;
use App\Flexy\ShopBundle\Entity\Shipping\Vehicle\ShippingVehicle;
use App\Flexy\ShopBundle\Entity\Shipping\Vehicle\ShippingVehicleType;
use App\Flexy\Apps\TransportBundle\Repository\MissionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\UX\Turbo\Attribute\Broadcast;
#[ORM\Entity(repositoryClass: MissionRepository::class)]
#[ApiResource]
//#[Broadcast]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class Mission implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $datePickup = null;
#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $timePickup = null;
#[ORM\Column(nullable: true)]
private ?int $nbrAdults = null;
#[ORM\Column(nullable: true)]
private ?int $nbrChildrens = null;
#[ORM\Column(nullable: true)]
private ?int $nbrBags = null;
#[ORM\ManyToOne(cascade:["persist"])]
private ?Order $relatedOrder = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $lang = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $type = null;
#[ORM\Column(type: Types::JSON, nullable: true)]
private ?array $handicap = null;
#[ORM\Column(type: Types::JSON, nullable: true)]
private array $forfait = [];
#[ORM\Column(length: 255, nullable: true)]
private ?string $status = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $endMissionDate = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $endMissionTime = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $realPickupDate = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $realStartMission = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $realDeliveryDate = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $deletedAt = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Shipment $shipment = null;
#[ORM\OneToMany(mappedBy: 'mission', targetEntity: MissionExtraFees::class)]
private Collection $missionExtraFees;
#[ORM\Column(nullable: true)]
private ?bool $departSiege = null;
#[ORM\Column(nullable: true)]
private ?bool $sharedShuttle = null;
#[ORM\Column(nullable: true)]
private ?float $price = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $vendorCompanyName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[ORM\ManyToOne]
private ?ShippingVehicleType $shippingVehicleType = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $driverComment = null;
#[ORM\ManyToOne]
private ?Agent $driver = null;
#[ORM\Column(nullable: true)]
private ?bool $moneyTakenByDriver = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $acceptedByDriver = null;
#[ORM\ManyToOne]
private ?CustomerGroup $customerGroup = null;
#[ORM\ManyToOne]
private ?ShippingVehicle $shippingVehicle = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $duplicationStartAt = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $duplicationEndAt = null;
#[ORM\Column(nullable: true)]
private ?bool $duplicationMonday = null;
#[ORM\Column(nullable: true)]
private array $duplicationDays = [];
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'duplicatedMissions',cascade:["persist"])]
private ?self $originMission = null;
#[ORM\OneToMany(mappedBy: 'originMission', targetEntity: self::class)]
private Collection $duplicatedMissions;
public function __construct()
{
$this->missionExtraFees = new ArrayCollection();
$this->duplicatedMissions = new ArrayCollection();
}
public function __toString(): string
{
return (string)$this->description;
}
public function getId(): ?int
{
return $this->id;
}
public function getMissionNumber():string
{
return "BM-0000".$this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDatePickup(): ?\DateTimeInterface
{
return $this->datePickup;
}
public function setDatePickup(?\DateTimeInterface $datePickup): self
{
$this->datePickup = $datePickup;
return $this;
}
public function getTimePickup(): ?\DateTimeInterface
{
return $this->timePickup;
}
public function setTimePickup(?\DateTimeInterface $timePickup): self
{
$this->timePickup = $timePickup;
return $this;
}
public function getNbrAdults(): ?int
{
return $this->nbrAdults;
}
public function setNbrAdults(?int $nbrAdults): self
{
$this->nbrAdults = $nbrAdults;
return $this;
}
public function getNbrChildrens(): ?int
{
return $this->nbrChildrens;
}
public function setNbrChildrens(?int $nbrChildrens): self
{
$this->nbrChildrens = $nbrChildrens;
return $this;
}
public function getNbrBags(): ?int
{
return $this->nbrBags;
}
public function setNbrBags(?int $nbrBags): self
{
$this->nbrBags = $nbrBags;
return $this;
}
public function getRelatedOrder(): ?Order
{
return $this->relatedOrder;
}
public function setRelatedOrder(?Order $relatedOrder): self
{
$this->relatedOrder = $relatedOrder;
return $this;
}
public function getLang(): ?string
{
return $this->lang;
}
public function setLang(?string $lang): self
{
$this->lang = $lang;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getHandicap(): ?array
{
return $this->handicap;
}
public function setHandicap(?array $handicap): self
{
$this->handicap = $handicap;
return $this;
}
public function getForfait(): array
{
return $this->forfait;
}
public function setForfait(?array $forfait): self
{
$this->forfait = $forfait;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getRealPickupDate(): ?\DateTimeInterface
{
return $this->realPickupDate;
}
public function setRealPickupDate(?\DateTimeInterface $realPickupDate): self
{
$this->realPickupDate = $realPickupDate;
return $this;
}
public function getRealStartMission(): ?\DateTimeInterface
{
return $this->realStartMission;
}
public function setRealStartMission(?\DateTimeInterface $realStartMission): self
{
$this->realStartMission = $realStartMission;
return $this;
}
public function getRealDeliveryDate(): ?\DateTimeInterface
{
return $this->realDeliveryDate;
}
public function setRealDeliveryDate(?\DateTimeInterface $realDeliveryDate): self
{
$this->realDeliveryDate = $realDeliveryDate;
return $this;
}
public function getNbrPax(){
$nbrPax = 0;
$nbrPax = $this->getNbrAdults()+$this->getNbrChildrens();
return $nbrPax;
}
/**
* Get the value of deletedAt
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
/**
* Set the value of deletedAt
*
* @return self
*/
public function setDeletedAt($deletedAt)
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getShipment(): ?Shipment
{
return $this->shipment;
}
public function setShipment(?Shipment $shipment): self
{
$this->shipment = $shipment;
return $this;
}
/**
* @return Collection<int, MissionExtraFees>
*/
public function getMissionExtraFees(): Collection
{
return $this->missionExtraFees;
}
public function addMissionExtraFee(MissionExtraFees $missionExtraFee): self
{
if (!$this->missionExtraFees->contains($missionExtraFee)) {
$this->missionExtraFees->add($missionExtraFee);
$missionExtraFee->setMission($this);
}
return $this;
}
public function removeMissionExtraFee(MissionExtraFees $missionExtraFee): self
{
if ($this->missionExtraFees->removeElement($missionExtraFee)) {
// set the owning side to null (unless already changed)
if ($missionExtraFee->getMission() === $this) {
$missionExtraFee->setMission(null);
}
}
return $this;
}
public function getTargetMap(){
return null;
}
/**
* Get the value of endMissionDate
*/
public function getEndMissionDate()
{
return $this->endMissionDate;
}
/**
* Set the value of endMissionDate
*
* @return self
*/
public function setEndMissionDate($endMissionDate)
{
$this->endMissionDate = $endMissionDate;
return $this;
}
/**
* Get the value of endMissionTime
*/
public function getEndMissionTime()
{
return $this->endMissionTime;
}
/**
* Set the value of endMissionTime
*
* @return self
*/
public function setEndMissionTime($endMissionTime)
{
$this->endMissionTime = $endMissionTime;
return $this;
}
public function isDepartSiege(): ?bool
{
return $this->departSiege;
}
public function setDepartSiege(?bool $departSiege): self
{
$this->departSiege = $departSiege;
return $this;
}
public function isSharedShuttle(): ?bool
{
return $this->sharedShuttle;
}
public function setSharedShuttle(?bool $sharedShuttle): self
{
$this->sharedShuttle = $sharedShuttle;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getVendorCompanyName(): ?string
{
return $this->vendorCompanyName;
}
public function setVendorCompanyName(?string $vendorCompanyName): self
{
$this->vendorCompanyName = $vendorCompanyName;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getShippingVehicleType(): ?ShippingVehicleType
{
return $this->shippingVehicleType;
}
public function setShippingVehicleType(?ShippingVehicleType $shippingVehicleType): self
{
$this->shippingVehicleType = $shippingVehicleType;
return $this;
}
public function getDriverComment(): ?string
{
return $this->driverComment;
}
public function setDriverComment(?string $driverComment): self
{
$this->driverComment = $driverComment;
return $this;
}
public function getDriver(): ?Agent
{
return $this->driver;
}
public function setDriver(?Agent $driver): self
{
$this->driver = $driver;
return $this;
}
public function isMoneyTakenByDriver(): ?bool
{
return $this->moneyTakenByDriver;
}
public function setMoneyTakenByDriver(?bool $moneyTakenByDriver): self
{
$this->moneyTakenByDriver = $moneyTakenByDriver;
return $this;
}
public function getAcceptedByDriver(): ?string
{
return $this->acceptedByDriver;
}
public function setAcceptedByDriver(?string $acceptedByDriver): self
{
$this->acceptedByDriver = $acceptedByDriver;
return $this;
}
public function getCustomerGroup(): ?CustomerGroup
{
return $this->customerGroup;
}
public function setCustomerGroup(?CustomerGroup $customerGroup): self
{
$this->customerGroup = $customerGroup;
return $this;
}
public function getShippingVehicle(): ?ShippingVehicle
{
return $this->shippingVehicle;
}
public function setShippingVehicle(?ShippingVehicle $shippingVehicle): self
{
$this->shippingVehicle = $shippingVehicle;
return $this;
}
public function getDuplicationStartAt(): ?\DateTimeInterface
{
return $this->duplicationStartAt;
}
public function setDuplicationStartAt(?\DateTimeInterface $duplicationStartAt): self
{
$this->duplicationStartAt = $duplicationStartAt;
return $this;
}
public function getDuplicationEndAt(): ?\DateTimeInterface
{
return $this->duplicationEndAt;
}
public function setDuplicationEndAt(?\DateTimeInterface $duplicationEndAt): self
{
$this->duplicationEndAt = $duplicationEndAt;
return $this;
}
public function isDuplicationMonday(): ?bool
{
return $this->duplicationMonday;
}
public function setDuplicationMonday(?bool $duplicationMonday): self
{
$this->duplicationMonday = $duplicationMonday;
return $this;
}
public function getDuplicationDays(): array
{
return $this->duplicationDays;
}
public function setDuplicationDays(?array $duplicationDays): self
{
$this->duplicationDays = $duplicationDays;
return $this;
}
public function getOriginMission(): ?self
{
return $this->originMission;
}
public function setOriginMission(?self $originMission): self
{
$this->originMission = $originMission;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getDuplicatedMissions(): Collection
{
return $this->duplicatedMissions;
}
public function addDuplicatedMission(self $duplicatedMission): self
{
if (!$this->duplicatedMissions->contains($duplicatedMission)) {
$this->duplicatedMissions->add($duplicatedMission);
$duplicatedMission->setOriginMission($this);
}
return $this;
}
public function removeDuplicatedMission(self $duplicatedMission): self
{
if ($this->duplicatedMissions->removeElement($duplicatedMission)) {
// set the owning side to null (unless already changed)
if ($duplicatedMission->getOriginMission() === $this) {
$duplicatedMission->setOriginMission(null);
}
}
return $this;
}
}