src/Entity/BatchType.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BatchTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Entity(repositoryClassBatchTypeRepository::class)]
  10. class BatchType
  11. {
  12.     use TimestampableEntity;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $transactionSubType null;
  23.     #[ORM\OneToMany(mappedBy'batchType'targetEntityOrder::class)]
  24.     private Collection $orders;
  25.     public function __construct()
  26.     {
  27.         $this->orders = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getName(): ?string
  34.     {
  35.         return $this->name;
  36.     }
  37.     public function setName(string $name): self
  38.     {
  39.         $this->name $name;
  40.         return $this;
  41.     }
  42.     public function getDescription(): ?string
  43.     {
  44.         return $this->description;
  45.     }
  46.     public function setDescription(?string $description): self
  47.     {
  48.         $this->description $description;
  49.         return $this;
  50.     }
  51.     public function getTransactionSubType(): ?string
  52.     {
  53.         return $this->transactionSubType;
  54.     }
  55.     public function setTransactionSubType(?string $transactionSubType): self
  56.     {
  57.         $this->transactionSubType $transactionSubType;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection<int, Order>
  62.      */
  63.     public function getOrders(): Collection
  64.     {
  65.         return $this->orders;
  66.     }
  67.     public function addOrder(Order $order): self
  68.     {
  69.         if (!$this->orders->contains($order)) {
  70.             $this->orders->add($order);
  71.             $order->setBatchType($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeOrder(Order $order): self
  76.     {
  77.         if ($this->orders->removeElement($order)) {
  78.             // set the owning side to null (unless already changed)
  79.             if ($order->getBatchType() === $this) {
  80.                 $order->setBatchType(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85.     public function __toString(): string
  86.     {
  87.         return $this->name;
  88.     }
  89. }