src/Entity/Order.php line 28
<?phpnamespace App\Entity;use App\Enum\UnitType;use App\Enum\AmountUnitType;use App\Enum\CustomerClass;use App\Enum\CustomerGeneralClass;use App\Enum\OrderCommissionable;use App\Enum\OrderStatus;use App\Entity\OrderType;use App\Enum\State;use App\Repository\OrderRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: OrderRepository::class)]#[ORM\Table(name: '`order`')]#[ORM\Index(columns: ['invoice_number'], name: 'invoice_number_idx')]#[ORM\Index(columns: ['order_code', 'item_code'], name: 'order_code_item_code_idx')]#[ORM\Index(columns: ['user_payment_period_id', 'customer_general_class'], name: 'upp_customer_general_class_idx')]#[ORM\Index(columns: ['incentive_date'], name: 'order_incentive_date')]#[ORM\Index(columns: ['user_id'], name: 'order_user_id')]class Order{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $incentiveDate = null;#[ORM\Column(length: 255, nullable: true)]private ?string $batchName = null;#[ORM\Column(nullable: true)]private ?float $amount = null;#[ORM\Column(nullable: true)]private ?AmountUnitType $amountUnitType = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $statusDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $createdDate = null;#[ORM\Column(length: 255, nullable: true)]private ?string $customerName = null;#[ORM\Column(length: 255, nullable: true)]private ?CustomerClass $customerSalesClass = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(nullable: true)]private ?int $discount = null;#[ORM\Column(nullable: true)]private ?int $quantity = 1;#[ORM\Column(length: 255, nullable: true)]private ?string $relatedItemCode = null;#[ORM\Column(length: 255, nullable: true)]private ?string $relatedOrderCode = null;#[ORM\Column(nullable: true)]private ?int $shipToNumber = null;#[ORM\Column(length: 255, nullable: true)]private ?State $shipToState = null;#[ORM\Column(length: 255, nullable: true)]private ?string $shipToZip = null;#[ORM\Column(length: 255, nullable: true)]private ?string $invoiceNumber = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $invoiceDate = null;#[ORM\Column(length: 255, nullable: true)]private ?string $orderRefNumber = null;#[ORM\Column(length: 255, nullable: true)]private ?string $independentRepNumber = null;#[ORM\Column(nullable: true)]private ?float $commissionRatePercent = null;#[ORM\ManyToOne(fetch: "EAGER")]private ?User $user = null;#[ORM\Column]private ?int $splitPercent = 0;#[ORM\Column]private bool $isCommissionable = true;#[ORM\Column(length: 255, nullable: true)]private ?string $customerEmployeeRepCode = null;#[ORM\ManyToOne(cascade: ['REMOVE'], inversedBy: 'orders')]private ?UserPaymentPeriod $userPaymentPeriod = null;#[ORM\Column(length: 255, nullable: true)]private ?CustomerGeneralClass $customerGeneralClass = null;#[ORM\Column(length: 255, nullable: true)]private ?string $employeeRepCode = null;#[ORM\Column(length: 255, nullable: true)]private ?UnitType $commissionRateUnitType = null;#[ORM\Column(length: 255, nullable: true)]private ?string $orderCode = null;#[ORM\Column(length: 255, nullable: true)]private ?string $itemCode = null;#[ORM\ManyToOne(inversedBy: 'orders')]private ?Period $period = null;#[ORM\ManyToOne(inversedBy: 'orders', fetch: "EAGER")]private ?Customer $customer = null;#[ORM\Column(length: 255, nullable: true)]private ?string $customerNumber = null;#[ORM\ManyToOne(inversedBy: 'orders', fetch: "EAGER")]private ?OrderType $orderType = null;#[ORM\ManyToOne(inversedBy: 'orders', fetch: "EAGER")]private ?BatchType $batchType = null;#[ORM\OneToMany(mappedBy: 'orderItem', targetEntity: Commission::class, cascade: ['persist', 'remove'])]#[ORM\OrderBy(['user' => 'ASC'])]private Collection $commissions;#[ORM\OneToMany(mappedBy: 'orderItem', targetEntity: Credit::class, cascade: ['persist', 'remove'])]#[ORM\OrderBy(['user' => 'ASC'])]private Collection $credits;#[ORM\Column(length: 255)]private ?OrderStatus $status = OrderStatus::NEW;#[ORM\OneToMany(mappedBy: 'orderItem', targetEntity: OrderAssignment::class, cascade: ['persist', 'remove'])]private Collection $orderAssignments;#[ORM\Column(length: 255, nullable: true)]private ?string $customerNumber2 = null;#[ORM\Column(length: 255, nullable: true)]private ?string $customerNumberTruncated = null;#[ORM\ManyToOne(inversedBy: 'orders')]private ?ImportFile $importFile = null;#[ORM\Column]private ?bool $rollable = true;#[ORM\Column]private ?bool $manual = false;public function __construct(){$this->commissions = new ArrayCollection();$this->credits = new ArrayCollection();$this->orderAssignments = new ArrayCollection();}public function setId($id): ?int{return $this->id = $id;}public function getId(): ?int{return $this->id;}public function getIncentiveDate(): ?\DateTimeInterface{return $this->incentiveDate;}public function setIncentiveDate(?\DateTimeInterface $incentiveDate): self{$this->incentiveDate = $incentiveDate;return $this;}public function getBatchName(): ?string{return $this->batchName;}public function setBatchName(?string $batchName): self{$this->batchName = $batchName;return $this;}public function getDividedAmount(): ?float{return ($this->amount ?: 0) / 100.00;}public function getAmount(): ?float{return $this->amount;}public function setAmount(?float $amount): self{$this->amount = $amount;return $this;}public function getAmountUnitType() : ?AmountUnitType{return $this->amountUnitType;}public function getAmountUnitTypeString() : string{return $this->amountUnitType?->value ?: 'USD';}public function setAmountUnitType(?AmountUnitType $amountUnitType): self{$this->amountUnitType = $amountUnitType;return $this;}public function getStatusDate(): ?\DateTimeInterface{return $this->statusDate;}public function setStatusDate(?\DateTimeInterface $statusDate): self{$this->statusDate = $statusDate;return $this;}public function getCreatedDate(): ?\DateTimeInterface{return $this->createdDate;}public function setCreatedDate(?\DateTimeInterface $createdDate): self{$this->createdDate = $createdDate;return $this;}public function getCustomerName(): ?string{return $this->customerName;}public function setCustomerName(?string $customerName): self{$this->customerName = $customerName;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getDiscount(): ?int{return $this->discount;}public function setDiscount(?int $discount): self{$this->discount = $discount;return $this;}public function getQuantity(): ?int{return $this->quantity;}public function setQuantity(?int $quantity): self{$this->quantity = $quantity;return $this;}public function getRelatedItemCode(): ?string{return $this->relatedItemCode;}public function setRelatedItemCode(?string $relatedItemCode): self{$this->relatedItemCode = $relatedItemCode;return $this;}public function getRelatedOrderCode(): ?string{return $this->relatedOrderCode;}public function setRelatedOrderCode(?string $relatedOrderCode): self{$this->relatedOrderCode = $relatedOrderCode;return $this;}public function getShipToNumber(): ?int{return $this->shipToNumber;}public function setShipToNumber(?int $shipToNumber): self{$this->shipToNumber = $shipToNumber;return $this;}public function getShipToState(): ?string{return $this->shipToState?->value ?: '';}public function setShipToState(?State $shipToState): self{$this->shipToState = $shipToState;return $this;}public function getShipToZip(): ?string{return $this->shipToZip;}public function setShipToZip(?string $shipToZip): self{$this->shipToZip = $shipToZip;return $this;}public function getInvoiceNumber(): ?string{return $this->invoiceNumber;}public function setInvoiceNumber(?string $invoiceNumber): self{$this->invoiceNumber = $invoiceNumber;return $this;}public function getOrderRefNumber(): ?string{return $this->orderRefNumber;}public function setOrderRefNumber(?string $orderRefNumber): self{$this->orderRefNumber = $orderRefNumber;return $this;}public function getCustomerSalesClass(): ?CustomerClass{return $this->customerSalesClass;}public function setCustomerSalesClass(?CustomerClass $customerSalesClass): self{$this->customerSalesClass = $customerSalesClass;$general = null;if ($customerSalesClass) {if ($customerSalesClass == CustomerClass::TM_OTG) {$general = CustomerGeneralClass::OTG;} else {$general = CustomerGeneralClass::from($customerSalesClass->value);}}$this->setCustomerGeneralClass($general);return $this;}public function getIndependentRepNumber(): ?string{return $this->independentRepNumber;}public function setIndependentRepNumber(?string $independentRepNumber): self{$this->independentRepNumber = $independentRepNumber;return $this;}public function getCommissionRatePercent(): ?float{return $this->commissionRatePercent;}public function setCommissionRatePercent(?float $commissionRatePercent): self{$this->commissionRatePercent = $commissionRatePercent;return $this;}public function getInvoiceDate(): ?\DateTimeInterface{return $this->invoiceDate;}public function setInvoiceDate(?\DateTimeInterface $invoiceDate): self{$this->invoiceDate = $invoiceDate;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getSplitPercent(): ?int{return $this->splitPercent;}public function setSplitPercent(?int $splitPercent): self{$this->splitPercent = $splitPercent;return $this;}public function getIsCommissionable(): bool{return $this->isCommissionable;}public function setIsCommissionable(bool $isCommissionable): self{$this->isCommissionable = $isCommissionable;return $this;}public function getCustomerEmployeeRepCode(): ?string{return $this->customerEmployeeRepCode;}public function setCustomerEmployeeRepCode(?string $customerEmployeeRepCode): self{$this->customerEmployeeRepCode = $customerEmployeeRepCode;return $this;}public function getUserPaymentPeriod(): ?UserPaymentPeriod{return $this->userPaymentPeriod;}public function setUserPaymentPeriod(?UserPaymentPeriod $userPaymentPeriod): self{$this->userPaymentPeriod = $userPaymentPeriod;return $this;}public function getCustomerGeneralClass(): ?CustomerGeneralClass{return $this->customerGeneralClass;}public function setCustomerGeneralClass(?CustomerGeneralClass $customerGeneralClass): self{$this->customerGeneralClass = $customerGeneralClass;return $this;}public function getEmployeeRepCode(): ?string{return $this->employeeRepCode;}public function setEmployeeRepCode(?string $employeeRepCode): self{$this->employeeRepCode = $employeeRepCode;return $this;}public function getCommissionRateUnitType(): ?UnitType{return $this->commissionRateUnitType;}public function setCommissionRateUnitType(?UnitType $commissionRateUnitType): self{$this->commissionRateUnitType = $commissionRateUnitType;return $this;}public function getOrderCode(): ?string{return $this->orderCode;}public function setOrderCode(?string $orderCode): self{$this->orderCode = $orderCode;return $this;}public function getItemCode(): ?string{return $this->itemCode;}public function setItemCode(?string $itemCode): self{$this->itemCode = $itemCode;return $this;}public function getPeriod(): ?Period{return $this->period;}public function setPeriod(?Period $period): self{$this->period = $period;return $this;}public function getCustomer(): ?Customer{return $this->customer;}public function setCustomer(?Customer $customer): self{$this->customer = $customer;return $this;}public function getCustomerNumber(): ?string{return $this->customerNumber;}public function setCustomerNumber(?string $customerNumber): self{$this->customerNumber = $customerNumber;return $this;}public function getOrderType(): ?OrderType{return $this->orderType;}public function setOrderType(?OrderType $orderType): self{$this->orderType = $orderType;return $this;}public function getBatchType(): ?BatchType{return $this->batchType;}public function setBatchType(?BatchType $batchType): self{$this->batchType = $batchType;return $this;}/*** @return Collection<int, Commission>*/public function getCommissions(): Collection{return $this->commissions;}public function getXactlyCommissions(): Collection{return $this->commissions->filter(function (Commission $commission) {return !$commission->isL6();});}/*** @return Collection<int, Credit>*/public function getL6Commissions(): Collection{return $this->commissions->filter(function (Commission $commission) {return $commission->isL6();});}public function addCommission(Commission $commission): static{if (!$this->commissions->contains($commission)) {$this->commissions->add($commission);$commission->setOrderItem($this);}return $this;}public function removeCommission(Commission $commission): static{if ($this->commissions->removeElement($commission)) {// set the owning side to null (unless already changed)if ($commission->getOrderItem() === $this) {$commission->setOrderItem(null);}}return $this;}/*** @return Collection<int, Credit>*/public function getCredits(): Collection{return $this->credits;}/*** @return Collection<int, Credit>*/public function getXactlyCredits(): Collection{return $this->credits->filter(function (Credit $credit) {return !$credit->isL6();});}/*** @return Collection<int, Credit>*/public function getL6Credits(): Collection{return $this->credits->filter(function (Credit $credit) {return $credit->isL6();});}public function addCredit(Credit $credit): static{if (!$this->credits->contains($credit)) {$this->credits->add($credit);$credit->setOrderItem($this);}return $this;}public function removeCredit(Credit $credit): static{if ($this->credits->removeElement($credit)) {// set the owning side to null (unless already changed)if ($credit->getOrderItem() === $this) {$credit->setOrderItem(null);}}return $this;}public function getStatus(): ?OrderStatus{return $this->status;}public function setStatus(OrderStatus $status): static{$this->status = $status;$this->statusDate = new \DateTime('now', new \DateTimeZone('UTC'));return $this;}/*** @return Collection<int, OrderAssignment>*/public function getOrderAssignments(): Collection{return $this->orderAssignments;}public function addOrderAssignment(OrderAssignment $orderAssignment): static{if (!$this->orderAssignments->contains($orderAssignment)) {$this->orderAssignments->add($orderAssignment);$orderAssignment->setOrderItem($this);}return $this;}public function removeOrderAssignment(OrderAssignment $orderAssignment): static{if ($this->orderAssignments->removeElement($orderAssignment)) {// set the owning side to null (unless already changed)if ($orderAssignment->getOrderItem() === $this) {$orderAssignment->setOrderItem(null);}}return $this;}public function getCustomerNumber2(): ?string{return $this->customerNumber2;}public function setCustomerNumber2(?string $customerNumber2): static{$this->customerNumber2 = $customerNumber2;return $this;}public function getCustomerNumberTruncated(): ?string{return $this->customerNumberTruncated;}public function setCustomerNumberTruncated(?string $customerNumberTruncated): static{$this->customerNumberTruncated = $customerNumberTruncated;return $this;}public function getImportFile(): ?ImportFile{return $this->importFile;}public function setImportFile(?ImportFile $importFile): static{$this->importFile = $importFile;return $this;}public function __toString(): string{return sprintf('%s - %s', $this->getOrderCode(), $this->getItemCode());}public function isRollable(): ?bool{return $this->rollable;}public function setRollable(bool $rollable): static{$this->rollable = $rollable;return $this;}public function isManual(): ?bool{return $this->manual;}public function setManual(bool $manual): static{$this->manual = $manual;return $this;}}