src/Flexy/ShopBundle/Entity/Shipping/StepType.php line 25

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Entity\Role;
  5. use App\Flexy\ShopBundle\Repository\Shipping\StepTypeRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. /**
  14.  * @example Represent the class responsible for creating status or steps for shipping like (Delivered,Picked,On Hold,Waiting,Processing,....)
  15.  */
  16. #[ORM\Entity(repositoryClassStepTypeRepository::class)]
  17. #[ApiResource(
  18.     normalizationContext: ['groups' => ['read']],
  19.     denormalizationContext: ['groups' => ['write']],
  20. )]
  21. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  22. class StepType
  23. {
  24.     use SoftDeleteableEntity;
  25.     
  26.     #[ORM\Id]
  27.     #[ORM\GeneratedValue]
  28.     #[ORM\Column]
  29.     #[Groups(["read"])]
  30.     private ?int $id null;
  31.     #[ORM\Column(length255)]
  32.     #[Groups(["write","read"])]
  33.     private ?string $name null;
  34.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  35.     #[Groups(["write","read"])]
  36.     private ?string $description null;
  37.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  38.     #[Groups(["write","read"])]
  39.     private ?\DateTimeInterface $createdAt null;
  40.     #[ORM\Column(nullabletrue)]
  41.     #[Gedmo\SortablePosition]
  42.     #[Groups(["write","read"])]
  43.     private ?int $priority null;
  44.     #[ORM\OneToMany(mappedBy'stepType'targetEntityTrackingStep::class,cascade:["persist","remove"])]
  45.     #[Groups(["write","read"])]
  46.     private Collection $trackingSteps;
  47.     #[ORM\Column(nullabletrue)]
  48.     #[Groups(["write","read"])]
  49.     private ?bool $isBidirectional null;
  50.     #[ORM\Column(nullabletrue)]
  51.     #[Groups(["write","read"])]
  52.     private ?bool $isBatchTracking null;
  53.     #[ORM\ManyToMany(targetEntityCity::class, inversedBy'stepTypes')]
  54.     #[Groups(["write","read"])]
  55.     private Collection $excludeCities;
  56.     #[ORM\Column(nullabletrue)]
  57.     #[Groups(["write","read"])]
  58.     private ?bool $isMultiShipments null;
  59.     #[ORM\Column(nullabletrue)]
  60.     #[Groups(["write","read"])]
  61.     private ?bool $canEditShipment null;
  62.     #[ORM\Column(length255,nullable:true)]
  63.     #[Gedmo\Slug(fields: ['name'])]
  64.     #[Groups(["write","read"])]
  65.     private ?string $code null;
  66.     #[ORM\Column(nullabletrue)]
  67.     #[Groups(["write","read"])]
  68.     private array $fieldsToEdit = [];
  69.     #[ORM\ManyToOne]
  70.     #[ORM\JoinColumn(nullabletrue)]
  71.     #[Groups(["write","read"])]
  72.     private ?Role $role null;
  73.     #[ORM\Column(length255,nullable:true)]
  74.     #[Groups(["write","read"])]
  75.     private ?string $directionHub "from-hub";
  76.     #[ORM\Column(nullabletrue)]
  77.     #[Groups(["write","read"])]
  78.     private ?bool $isExcludeHUB null;
  79.     /**
  80.      * 
  81.      *
  82.      * @example [notify-recipient] 
  83.      */
  84.     #[ORM\Column(nullabletrue)]
  85.     #[Groups(["write","read"])]
  86.     private array $events = [];
  87.     /**
  88.      * Undocumented variable
  89.      *
  90.      * @example Must be an hexadecimal like #fffff
  91.      */
  92.     #[ORM\Column(length255nullabletrue)]
  93.     #[Groups(["write","read"])]
  94.     private ?string $color null;
  95.     #[ORM\Column(length255nullabletrue)]
  96.     #[Groups(["write","read"])]
  97.     private ?string $textColor "#333";
  98.     #[Groups(["write","read"])]
  99.     #[ORM\ManyToMany(targetEntityRole::class)]
  100.     private Collection $roles;
  101.     public function __toString()
  102.     {
  103.         return $this->name;
  104.     }
  105.     public function __construct()
  106.     {
  107.         $this->trackingSteps = new ArrayCollection();
  108.         $this->excludeCities = new ArrayCollection();
  109.         $this->roles = new ArrayCollection();
  110.     }
  111.     public function getId(): ?int
  112.     {
  113.         return $this->id;
  114.     }
  115.     public function getName(): ?string
  116.     {
  117.         return $this->name;
  118.     }
  119.     public function setName(string $name): self
  120.     {
  121.         $this->name $name;
  122.         return $this;
  123.     }
  124.     public function getDescription(): ?string
  125.     {
  126.         return $this->description;
  127.     }
  128.     public function setDescription(?string $description): self
  129.     {
  130.         $this->description $description;
  131.         return $this;
  132.     }
  133.     public function getCreatedAt(): ?\DateTimeInterface
  134.     {
  135.         return $this->createdAt;
  136.     }
  137.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  138.     {
  139.         $this->createdAt $createdAt;
  140.         return $this;
  141.     }
  142.     public function getPriority(): ?int
  143.     {
  144.         return $this->priority;
  145.     }
  146.     public function setPriority(?int $priority): self
  147.     {
  148.         $this->priority $priority;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection<int, TrackingStep>
  153.      */
  154.     public function getTrackingSteps(): Collection
  155.     {
  156.         return $this->trackingSteps;
  157.     }
  158.     public function addTrackingStep(TrackingStep $shipmentTrackingStep): self
  159.     {
  160.         if (!$this->trackingSteps->contains($shipmentTrackingStep)) {
  161.             $this->trackingSteps->add($shipmentTrackingStep);
  162.             $shipmentTrackingStep->setStepType($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeTrackingStep(TrackingStep $shipmentTrackingStep): self
  167.     {
  168.         if ($this->trackingSteps->removeElement($shipmentTrackingStep)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($shipmentTrackingStep->getStepType() === $this) {
  171.                 $shipmentTrackingStep->setStepType(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     public function isIsBidirectional(): ?bool
  177.     {
  178.         return $this->isBidirectional;
  179.     }
  180.     public function setIsBidirectional(?bool $isBidirectional): self
  181.     {
  182.         $this->isBidirectional $isBidirectional;
  183.         return $this;
  184.     }
  185.     public function isIsBatchTracking(): ?bool
  186.     {
  187.         return $this->isBatchTracking;
  188.     }
  189.     public function setIsBatchTracking(?bool $isBatchTracking): self
  190.     {
  191.         $this->isBatchTracking $isBatchTracking;
  192.         return $this;
  193.     }
  194.     /**
  195.      * @return Collection<int, City>
  196.      */
  197.     public function getExcludeCities(): Collection
  198.     {
  199.         return $this->excludeCities;
  200.     }
  201.     public function addExcludeCity(City $excludeCity): self
  202.     {
  203.         if (!$this->excludeCities->contains($excludeCity)) {
  204.             $this->excludeCities->add($excludeCity);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeExcludeCity(City $excludeCity): self
  209.     {
  210.         $this->excludeCities->removeElement($excludeCity);
  211.         return $this;
  212.     }
  213.     public function isIsMultiShipments(): ?bool
  214.     {
  215.         return $this->isMultiShipments;
  216.     }
  217.     public function setIsMultiShipments(?bool $isMultiShipments): self
  218.     {
  219.         $this->isMultiShipments $isMultiShipments;
  220.         return $this;
  221.     }
  222.     public function isCanEditShipment(): ?bool
  223.     {
  224.         return $this->canEditShipment;
  225.     }
  226.     public function setCanEditShipment(?bool $canEditShipment): self
  227.     {
  228.         $this->canEditShipment $canEditShipment;
  229.         return $this;
  230.     }
  231.     public function getCode(): ?string
  232.     {
  233.         return $this->code;
  234.     }
  235.     public function setCode(string $code): self
  236.     {
  237.         $this->code $code;
  238.         return $this;
  239.     }
  240.     public function getFieldsToEdit(): array
  241.     {
  242.         return $this->fieldsToEdit;
  243.     }
  244.     public function setFieldsToEdit(?array $fieldsToEdit): self
  245.     {
  246.         $this->fieldsToEdit $fieldsToEdit;
  247.         return $this;
  248.     }
  249.     public function getRole(): ?Role
  250.     {
  251.         return $this->role;
  252.     }
  253.     public function setRole(?Role $role): self
  254.     {
  255.         $this->role $role;
  256.         return $this;
  257.     }
  258.     public function getDirectionHub(): ?string
  259.     {
  260.         return $this->directionHub;
  261.     }
  262.     public function setDirectionHub(string $directionHub): self
  263.     {
  264.         $this->directionHub $directionHub;
  265.         return $this;
  266.     }
  267.     public function isIsExcludeHUB(): ?bool
  268.     {
  269.         return $this->isExcludeHUB;
  270.     }
  271.     public function setIsExcludeHUB(?bool $isExcludeHUB): self
  272.     {
  273.         $this->isExcludeHUB $isExcludeHUB;
  274.         return $this;
  275.     }
  276.     public function getEvents(): array
  277.     {
  278.         return $this->events;
  279.     }
  280.     public function setEvents(?array $events): self
  281.     {
  282.         $this->events $events;
  283.         return $this;
  284.     }
  285.     public function getColor(): ?string
  286.     {
  287.         return $this->color;
  288.     }
  289.     public function setColor(?string $color): self
  290.     {
  291.         $this->color $color;
  292.         return $this;
  293.     }
  294.     public function getTextColor(): ?string
  295.     {
  296.         return $this->textColor;
  297.     }
  298.     public function setTextColor(?string $textColor): self
  299.     {
  300.         $this->textColor $textColor;
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection<int, Role>
  305.      */
  306.     public function getRoles(): Collection
  307.     {
  308.         return $this->roles;
  309.     }
  310.     public function addRole(Role $role): static
  311.     {
  312.         if (!$this->roles->contains($role)) {
  313.             $this->roles->add($role);
  314.         }
  315.         return $this;
  316.     }
  317.     public function removeRole(Role $role): static
  318.     {
  319.         $this->roles->removeElement($role);
  320.         return $this;
  321.     }
  322. }