src/Flexy/TransportBundle/Entity/Mission.php line 19
<?php
namespace App\Flexy\TransportBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
use App\Flexy\ShopBundle\Entity\Shipping\ShipmentItem;
use App\Repository\Flexy\TransportBundle\Entity\MissionRepository;
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]
private ?Order $relatedOrder = null;
#[ORM\OneToOne(inversedBy: 'parentMission', targetEntity: self::class, cascade: ['persist', 'remove'])]
private ?self $relatedMission = null;
#[ORM\OneToOne(mappedBy: 'relatedMission', targetEntity: self::class, cascade: ['persist', 'remove'])]
private ?self $parentMission = 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 $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;
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 getRelatedMission(): ?self
{
return $this->relatedMission;
}
public function setRelatedMission(?self $relatedMission): self
{
$this->relatedMission = $relatedMission;
return $this;
}
public function getParentMission(): ?self
{
return $this->parentMission;
}
public function setParentMission(?self $parentMission): self
{
// unset the owning side of the relation if necessary
if ($parentMission === null && $this->parentMission !== null) {
$this->parentMission->setRelatedMission(null);
}
// set the owning side of the relation if necessary
if ($parentMission !== null && $parentMission->getRelatedMission() !== $this) {
$parentMission->setRelatedMission($this);
}
$this->parentMission = $parentMission;
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;
}
}