src/Flexy/ShopBundle/Entity/Shipping/TrackingStep.php line 17
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping;
use ApiPlatform\Metadata\ApiResource;
use App\Flexy\ShopBundle\Repository\Shipping\TrackingStepRepository;
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 Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
#[ORM\Entity(repositoryClass: TrackingStepRepository::class)]
#[ApiResource]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class TrackingStep
{
use SoftDeleteableEntity;
#[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\ManyToOne(inversedBy: 'trackingSteps')]
#[ORM\JoinColumn(nullable: false)]
private ?Shipment $shipment = null;
#[ORM\ManyToOne(inversedBy: 'trackingSteps')]
private ?StepType $stepType = null;
#[ORM\Column(length: 255)]
/* Accept two values ( to-recepient or to-sender ) */
private ?string $directionType = "to-recepient";
#[ORM\ManyToMany(targetEntity: ShipmentItemChild::class, mappedBy: 'trackingSteps')]
private Collection $shipmentItemChildren;
#[ORM\Column(nullable: true)]
private ?bool $isCompleted = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $status = null;
#[ORM\Column(length: 255, nullable: true)]
#[Gedmo\Blameable(on: 'create')]
private ?string $createdBy = null;
#[ORM\Column(length: 255, nullable: true)]
#[Gedmo\Blameable(on: 'update')]
private ?string $updatedBy = null;
public function __construct()
{
$this->shipmentItemChildren = new ArrayCollection();
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $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 getShipment(): ?Shipment
{
return $this->shipment;
}
public function setShipment(?Shipment $shipment): self
{
$this->shipment = $shipment;
return $this;
}
public function getStepType(): ?StepType
{
return $this->stepType;
}
public function setStepType(?StepType $stepType): self
{
$this->stepType = $stepType;
return $this;
}
public function getDirectionType(): ?string
{
return $this->directionType;
}
public function setDirectionType(string $directionType): self
{
$this->directionType = $directionType;
return $this;
}
/**
* @return Collection<int, ShipmentItemChild>
*/
public function getShipmentItemChildren(): Collection
{
return $this->shipmentItemChildren;
}
public function addShipmentItemChild(ShipmentItemChild $shipmentItemChild): self
{
if (!$this->shipmentItemChildren->contains($shipmentItemChild)) {
$this->shipmentItemChildren->add($shipmentItemChild);
$shipmentItemChild->addTrackingStep($this);
}
return $this;
}
public function removeShipmentItemChild(ShipmentItemChild $shipmentItemChild): self
{
if ($this->shipmentItemChildren->removeElement($shipmentItemChild)) {
$shipmentItemChild->removeTrackingStep($this);
}
return $this;
}
public function isIsCompleted(): ?bool
{
return $this->isCompleted;
}
public function setIsCompleted(?bool $isCompleted): self
{
$this->isCompleted = $isCompleted;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getCreatedBy(): ?string
{
return $this->createdBy;
}
public function setCreatedBy(?string $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedBy(): ?string
{
return $this->updatedBy;
}
public function setUpdatedBy(?string $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
}