src/Flexy/ShopBundle/Entity/Shipping/StepType.php line 25
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Entity\Role;
use App\Flexy\ShopBundle\Repository\Shipping\StepTypeRepository;
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;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @example Represent the class responsible for creating status or steps for shipping like (Delivered,Picked,On Hold,Waiting,Processing,....)
*/
#[ORM\Entity(repositoryClass: StepTypeRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['read']],
denormalizationContext: ['groups' => ['write']],
)]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class StepType
{
use SoftDeleteableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(["read"])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(["write","read"])]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Groups(["write","read"])]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups(["write","read"])]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(nullable: true)]
#[Gedmo\SortablePosition]
#[Groups(["write","read"])]
private ?int $priority = null;
#[ORM\OneToMany(mappedBy: 'stepType', targetEntity: TrackingStep::class,cascade:["persist","remove"])]
#[Groups(["write","read"])]
private Collection $trackingSteps;
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private ?bool $isBidirectional = null;
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private ?bool $isBatchTracking = null;
#[ORM\ManyToMany(targetEntity: City::class, inversedBy: 'stepTypes')]
#[Groups(["write","read"])]
private Collection $excludeCities;
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private ?bool $isMultiShipments = null;
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private ?bool $canEditShipment = null;
#[ORM\Column(length: 255,nullable:true)]
#[Gedmo\Slug(fields: ['name'])]
#[Groups(["write","read"])]
private ?string $code = null;
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private array $fieldsToEdit = [];
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: true)]
#[Groups(["write","read"])]
private ?Role $role = null;
#[ORM\Column(length: 255,nullable:true)]
#[Groups(["write","read"])]
private ?string $directionHub = "from-hub";
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private ?bool $isExcludeHUB = null;
/**
*
*
* @example [notify-recipient]
*/
#[ORM\Column(nullable: true)]
#[Groups(["write","read"])]
private array $events = [];
/**
* Undocumented variable
*
* @example Must be an hexadecimal like #fffff
*/
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["write","read"])]
private ?string $color = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["write","read"])]
private ?string $textColor = "#333";
#[Groups(["write","read"])]
#[ORM\ManyToMany(targetEntity: Role::class)]
private Collection $roles;
public function __toString()
{
return $this->name;
}
public function __construct()
{
$this->trackingSteps = new ArrayCollection();
$this->excludeCities = new ArrayCollection();
$this->roles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(?int $priority): self
{
$this->priority = $priority;
return $this;
}
/**
* @return Collection<int, TrackingStep>
*/
public function getTrackingSteps(): Collection
{
return $this->trackingSteps;
}
public function addTrackingStep(TrackingStep $shipmentTrackingStep): self
{
if (!$this->trackingSteps->contains($shipmentTrackingStep)) {
$this->trackingSteps->add($shipmentTrackingStep);
$shipmentTrackingStep->setStepType($this);
}
return $this;
}
public function removeTrackingStep(TrackingStep $shipmentTrackingStep): self
{
if ($this->trackingSteps->removeElement($shipmentTrackingStep)) {
// set the owning side to null (unless already changed)
if ($shipmentTrackingStep->getStepType() === $this) {
$shipmentTrackingStep->setStepType(null);
}
}
return $this;
}
public function isIsBidirectional(): ?bool
{
return $this->isBidirectional;
}
public function setIsBidirectional(?bool $isBidirectional): self
{
$this->isBidirectional = $isBidirectional;
return $this;
}
public function isIsBatchTracking(): ?bool
{
return $this->isBatchTracking;
}
public function setIsBatchTracking(?bool $isBatchTracking): self
{
$this->isBatchTracking = $isBatchTracking;
return $this;
}
/**
* @return Collection<int, City>
*/
public function getExcludeCities(): Collection
{
return $this->excludeCities;
}
public function addExcludeCity(City $excludeCity): self
{
if (!$this->excludeCities->contains($excludeCity)) {
$this->excludeCities->add($excludeCity);
}
return $this;
}
public function removeExcludeCity(City $excludeCity): self
{
$this->excludeCities->removeElement($excludeCity);
return $this;
}
public function isIsMultiShipments(): ?bool
{
return $this->isMultiShipments;
}
public function setIsMultiShipments(?bool $isMultiShipments): self
{
$this->isMultiShipments = $isMultiShipments;
return $this;
}
public function isCanEditShipment(): ?bool
{
return $this->canEditShipment;
}
public function setCanEditShipment(?bool $canEditShipment): self
{
$this->canEditShipment = $canEditShipment;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getFieldsToEdit(): array
{
return $this->fieldsToEdit;
}
public function setFieldsToEdit(?array $fieldsToEdit): self
{
$this->fieldsToEdit = $fieldsToEdit;
return $this;
}
public function getRole(): ?Role
{
return $this->role;
}
public function setRole(?Role $role): self
{
$this->role = $role;
return $this;
}
public function getDirectionHub(): ?string
{
return $this->directionHub;
}
public function setDirectionHub(string $directionHub): self
{
$this->directionHub = $directionHub;
return $this;
}
public function isIsExcludeHUB(): ?bool
{
return $this->isExcludeHUB;
}
public function setIsExcludeHUB(?bool $isExcludeHUB): self
{
$this->isExcludeHUB = $isExcludeHUB;
return $this;
}
public function getEvents(): array
{
return $this->events;
}
public function setEvents(?array $events): self
{
$this->events = $events;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getTextColor(): ?string
{
return $this->textColor;
}
public function setTextColor(?string $textColor): self
{
$this->textColor = $textColor;
return $this;
}
/**
* @return Collection<int, Role>
*/
public function getRoles(): Collection
{
return $this->roles;
}
public function addRole(Role $role): static
{
if (!$this->roles->contains($role)) {
$this->roles->add($role);
}
return $this;
}
public function removeRole(Role $role): static
{
$this->roles->removeElement($role);
return $this;
}
}