src/Flexy/ShopBundle/Entity/Shipping/TrackingStep.php line 17

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Flexy\ShopBundle\Repository\Shipping\TrackingStepRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  11. #[ORM\Entity(repositoryClassTrackingStepRepository::class)]
  12. #[ApiResource]
  13. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  14. class TrackingStep
  15. {
  16.     use SoftDeleteableEntity;
  17.     
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  23.     private ?\DateTimeInterface $createdAt null;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $description null;
  26.     #[ORM\ManyToOne(inversedBy'trackingSteps',cascade:["persist"])]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private ?Shipment $shipment null;
  29.     #[ORM\ManyToOne(inversedBy'trackingSteps')]
  30.     private ?StepType $stepType null;
  31.     #[ORM\Column(length255)]
  32.     /* Accept two values ( to-recepient or to-sender ) */
  33.     private ?string $directionType "to-recepient";
  34.     #[ORM\ManyToMany(targetEntityShipmentItemChild::class, mappedBy'trackingSteps')]
  35.     private Collection $shipmentItemChildren;
  36.     #[ORM\Column(nullabletrue)]
  37.     private ?bool $isCompleted null;
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $status null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     #[Gedmo\Blameable(on'create')]
  42.     private ?string $createdBy null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     #[Gedmo\Blameable(on'update')]
  45.     private ?string $updatedBy null;
  46.     public function __construct()
  47.     {
  48.         $this->shipmentItemChildren = new ArrayCollection();
  49.         $this->createdAt = new \DateTime();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getCreatedAt(): ?\DateTimeInterface
  56.     {
  57.         return $this->createdAt;
  58.     }
  59.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  60.     {
  61.         $this->createdAt $createdAt;
  62.         return $this;
  63.     }
  64.     public function getDescription(): ?string
  65.     {
  66.         return $this->description;
  67.     }
  68.     public function setDescription(?string $description): self
  69.     {
  70.         $this->description $description;
  71.         return $this;
  72.     }
  73.     public function getShipment(): ?Shipment
  74.     {
  75.         return $this->shipment;
  76.     }
  77.     public function setShipment(?Shipment $shipment): self
  78.     {
  79.         $this->shipment $shipment;
  80.         return $this;
  81.     }
  82.     public function getStepType(): ?StepType
  83.     {
  84.         return $this->stepType;
  85.     }
  86.     public function setStepType(?StepType $stepType): self
  87.     {
  88.         $this->stepType $stepType;
  89.         return $this;
  90.     }
  91.     public function getDirectionType(): ?string
  92.     {
  93.         return $this->directionType;
  94.     }
  95.     public function setDirectionType(string $directionType): self
  96.     {
  97.         $this->directionType $directionType;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection<int, ShipmentItemChild>
  102.      */
  103.     public function getShipmentItemChildren(): Collection
  104.     {
  105.         return $this->shipmentItemChildren;
  106.     }
  107.     public function addShipmentItemChild(ShipmentItemChild $shipmentItemChild): self
  108.     {
  109.         if (!$this->shipmentItemChildren->contains($shipmentItemChild)) {
  110.             $this->shipmentItemChildren->add($shipmentItemChild);
  111.             $shipmentItemChild->addTrackingStep($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeShipmentItemChild(ShipmentItemChild $shipmentItemChild): self
  116.     {
  117.         if ($this->shipmentItemChildren->removeElement($shipmentItemChild)) {
  118.             $shipmentItemChild->removeTrackingStep($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function isIsCompleted(): ?bool
  123.     {
  124.         return $this->isCompleted;
  125.     }
  126.     public function setIsCompleted(?bool $isCompleted): self
  127.     {
  128.         $this->isCompleted $isCompleted;
  129.         return $this;
  130.     }
  131.     public function getStatus(): ?string
  132.     {
  133.         return $this->status;
  134.     }
  135.     public function setStatus(?string $status): self
  136.     {
  137.         $this->status $status;
  138.         return $this;
  139.     }
  140.     public function getCreatedBy(): ?string
  141.     {
  142.         return $this->createdBy;
  143.     }
  144.     public function setCreatedBy(?string $createdBy): self
  145.     {
  146.         $this->createdBy $createdBy;
  147.         return $this;
  148.     }
  149.     public function getUpdatedBy(): ?string
  150.     {
  151.         return $this->updatedBy;
  152.     }
  153.     public function setUpdatedBy(?string $updatedBy): self
  154.     {
  155.         $this->updatedBy $updatedBy;
  156.         return $this;
  157.     }
  158. }