src/Entity/Order.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Constants\ActiveConstants;
  4. use App\Repository\OrderRepository;
  5. use App\Traits\TimeTrackTrait;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassOrderRepository::class)]
  9. #[ORM\Table(name'`order`')]
  10. #[ORM\HasLifecycleCallbacks]
  11. class Order
  12. {
  13.     use TimeTrackTrait;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column]
  19.     private ?int $status null;
  20.     #[ORM\Column(length191)]
  21.     private ?string $reference null;
  22.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  23.     private bool $lifecellActivationError false;
  24.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  25.     private bool $newNumberIssued false;
  26.     #[ORM\Column]
  27.     private ?float $price null;
  28.     #[ORM\Column(type"text"nullabletrue)]
  29.     private ?string $apiError null;
  30.     #[ORM\Column(type"text"nullabletrue)]
  31.     private ?string $paymentData null;
  32.     #[ORM\Column(length191nullabletrue)]
  33.     private ?string $idReceipt null;
  34.     #[ORM\Column(length191nullabletrue)]
  35.     private ?string $signature null;
  36.     #[ORM\Column(length191nullabletrue)]
  37.     private ?string $paymentUrl null;
  38.     #[ORM\Column(length191nullabletrue)]
  39.     private ?string $repayUrl null;
  40.     #[ORM\Column(length191nullabletrue)]
  41.     private ?string $userLifecellPosId null;
  42.     #[ORM\ManyToOne(inversedBy'orders')]
  43.     #[ORM\JoinColumn(nullablefalse)]
  44.     private ?User $user null;
  45.     #[ORM\ManyToOne(inversedBy'orders')]
  46.     #[ORM\JoinColumn(nullablefalse)]
  47.     private ?PhoneNumber $phoneNumber null;
  48.     #[ORM\ManyToOne(inversedBy'orders')]
  49.     #[ORM\JoinColumn(nullablefalse)]
  50.     private ?Company $company null;
  51.     #[ORM\Column(length191nullabletrue)]
  52.     private ?string $orderToken null;
  53.     private $payment;
  54.     /**
  55.      * @var \DateTime
  56.      */
  57.     #[ORM\Column(name'payment_accepted_at'type'datetime'nullabletrue)]
  58.     private $paymentAcceptedAt;
  59.     /**
  60.      * @var \DateTime
  61.      */
  62.     #[ORM\Column(name'esim_mail_resend_at'type'datetime'nullabletrue)]
  63.     private $esimMailResendAt;
  64.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  65.     private ?\DateTimeInterface $unfreezeNumberAt null;
  66.     #[ORM\ManyToOne(inversedBy'orders')]
  67.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  68.     private ?Voucher $voucher null;
  69.     #[ORM\ManyToOne(inversedBy'orders')]
  70.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  71.     private ?VoucherCode $voucherCode null;
  72.     #[ORM\Column(nullabletrue)]
  73.     private ?float $discount null;
  74.     #[ORM\Column(length255nullabletrue)]
  75.     private ?string $discountName null;
  76.     #[ORM\Column(type'text'nullabletrue)]
  77.     private ?string $metaTags null;
  78.     public function getVoucher(): ?Voucher
  79.     {
  80.         return $this->voucher;
  81.     }
  82.     public function setVoucher(?Voucher $voucher): static
  83.     {
  84.         $this->voucher $voucher;
  85.         return $this;
  86.     }
  87.     public function getVoucherCode(): ?VoucherCode
  88.     {
  89.         return $this->voucherCode;
  90.     }
  91.     public function setVoucherCode(?VoucherCode $voucherCode): static
  92.     {
  93.         $this->voucherCode $voucherCode;
  94.         return $this;
  95.     }
  96.     public function getSeries(): string
  97.     {
  98.         return 'AAAA';
  99.     }
  100.     public function getId(): ?int
  101.     {
  102.         return $this->id;
  103.     }
  104.     public function getStatus(): ?int
  105.     {
  106.         return $this->status;
  107.     }
  108.     public function setStatus(int $status): static
  109.     {
  110.         $this->status $status;
  111.         return $this;
  112.     }
  113.     public function getStatusLabel(): string
  114.     {
  115.         $statuses = [
  116.             => "Відправлене на оплату",
  117.             => "Успіх",
  118.             => "Прострочене замовлення",
  119.             => "Помилка оплати",
  120.             => "Очікує підтвердження від вашого банку",
  121.         ];
  122.         return $statuses[$this->status] ?? (string)$this->status;
  123.     }
  124.     public function getReference(): ?string
  125.     {
  126.         return $this->reference;
  127.     }
  128.     public function setReference(string $reference): static
  129.     {
  130.         $this->reference $reference;
  131.         return $this;
  132.     }
  133.     public function getSignature(): ?string
  134.     {
  135.         return $this->signature;
  136.     }
  137.     public function setSignature(?string $signature): static
  138.     {
  139.         $this->signature $signature;
  140.         return $this;
  141.     }
  142.     public function getUser(): ?User
  143.     {
  144.         return $this->user;
  145.     }
  146.     public function setUser(?User $user): static
  147.     {
  148.         $this->user $user;
  149.         return $this;
  150.     }
  151.     public function getPhoneNumber(): ?PhoneNumber
  152.     {
  153.         return $this->phoneNumber;
  154.     }
  155.     public function setPhoneNumber(?PhoneNumber $phoneNumber): static
  156.     {
  157.         $this->phoneNumber $phoneNumber;
  158.         return $this;
  159.     }
  160.     /**
  161.      * Set createdAt.
  162.      *
  163.      * @param \DateTime|null $createdAt
  164.      *
  165.      * @return Order
  166.      */
  167.     public function setCreatedAt($createdAt null)
  168.     {
  169.         $this->createdAt $createdAt;
  170.         return $this;
  171.     }
  172.     /**
  173.      * Get createdAt.
  174.      *
  175.      * @return \DateTime|null
  176.      */
  177.     public function getCreatedAt()
  178.     {
  179.         return $this->createdAt;
  180.     }
  181.     /**
  182.      * Set updatedAt.
  183.      *
  184.      * @param \DateTime|null $updatedAt
  185.      *
  186.      * @return Order
  187.      */
  188.     public function setUpdatedAt($updatedAt null)
  189.     {
  190.         $this->updatedAt $updatedAt;
  191.         return $this;
  192.     }
  193.     /**
  194.      * Get updatedAt.
  195.      *
  196.      * @return \DateTime|null
  197.      */
  198.     public function getUpdatedAt()
  199.     {
  200.         return $this->updatedAt;
  201.     }
  202.     public function __toString()
  203.     {
  204.         return $this->getReference();
  205.     }
  206.     public function getRepayUrl(): ?string
  207.     {
  208.         return $this->repayUrl;
  209.     }
  210.     public function setRepayUrl(?string $repayUrl): static
  211.     {
  212.         $this->repayUrl $repayUrl;
  213.         return $this;
  214.     }
  215.     public function getPaymentAcceptedAt(): ?\DateTimeInterface
  216.     {
  217.         return $this->paymentAcceptedAt;
  218.     }
  219.     public function setPaymentAcceptedAt(?\DateTimeInterface $paymentAcceptedAt): static
  220.     {
  221.         $this->paymentAcceptedAt $paymentAcceptedAt;
  222.         return $this;
  223.     }
  224.     public function getCompany(): ?Company
  225.     {
  226.         return $this->company;
  227.     }
  228.     public function setCompany(?Company $company): static
  229.     {
  230.         $this->company $company;
  231.         return $this;
  232.     }
  233.     public function getPaymentUrl(): ?string
  234.     {
  235.         return $this->paymentUrl;
  236.     }
  237.     public function setPaymentUrl(?string $paymentUrl): static
  238.     {
  239.         $this->paymentUrl $paymentUrl;
  240.         return $this;
  241.     }
  242.     public function getPrice(): ?float
  243.     {
  244.         return $this->price;
  245.     }
  246.     public function setPrice(float $price): static
  247.     {
  248.         $this->price $price;
  249.         return $this;
  250.     }
  251.     public function getEsimMailResendAt(): ?\DateTimeInterface
  252.     {
  253.         return $this->esimMailResendAt;
  254.     }
  255.     public function setEsimMailResendAt(?\DateTimeInterface $esimMailResendAt): static
  256.     {
  257.         $this->esimMailResendAt $esimMailResendAt;
  258.         return $this;
  259.     }
  260.     public function getApiError(): ?string
  261.     {
  262.         return $this->apiError;
  263.     }
  264.     public function hasApiError(): bool
  265.     {
  266.         return !empty($this->getApiError());
  267.     }
  268.     public function setApiError(?string $apiError): static
  269.     {
  270.         $this->apiError $apiError;
  271.         return $this;
  272.     }
  273.     public function isLifecellActivationError(): ?bool
  274.     {
  275.         return $this->lifecellActivationError;
  276.     }
  277.     public function setLifecellActivationError(bool $lifecellActivationError): static
  278.     {
  279.         $this->lifecellActivationError $lifecellActivationError;
  280.         return $this;
  281.     }
  282.     public function getUserLifecellPosId(): ?string
  283.     {
  284.         return $this->userLifecellPosId;
  285.     }
  286.     public function setUserLifecellPosId(?string $userLifecellPosId): static
  287.     {
  288.         $this->userLifecellPosId $userLifecellPosId;
  289.         return $this;
  290.     }
  291.     public function isNewNumberIssued(): ?bool
  292.     {
  293.         return $this->newNumberIssued;
  294.     }
  295.     public function setNewNumberIssued(bool $newNumberIssued): static
  296.     {
  297.         $this->newNumberIssued $newNumberIssued;
  298.         return $this;
  299.     }
  300.     public function getNewNumberIssuedLabel(): string
  301.     {
  302.         return $this->newNumberIssued ActiveConstants::LABEL_YES ActiveConstants::LABEL_NO;
  303.     }
  304.     public function getLifecellActivationErrorLabel(): string
  305.     {
  306.         return $this->lifecellActivationError ActiveConstants::LABEL_YES ActiveConstants::LABEL_NO;
  307.     }
  308.     public function getHasApiErrorLabel(): string
  309.     {
  310.         return $this->hasApiError() ? ActiveConstants::LABEL_YES ActiveConstants::LABEL_NO;
  311.     }
  312.     public function getUnfreezeNumberAt(): ?\DateTimeInterface
  313.     {
  314.         return $this->unfreezeNumberAt;
  315.     }
  316.     public function setUnfreezeNumberAt(?\DateTimeInterface $unfreezeNumberAt): static
  317.     {
  318.         $this->unfreezeNumberAt $unfreezeNumberAt;
  319.         return $this;
  320.     }
  321.     public function getTariff(): ?Tariff
  322.     {
  323.         return $this->getPhoneNumber()?->getTariff();
  324.     }
  325.     public function getStatusName()
  326.     {
  327.         $statuses = [
  328.             => "Відправлене на оплату",
  329.             => "Успіх",
  330.             => "Прострочене замовлення",
  331.             => "Помилка оплати",
  332.             => "Очікує підтвердження від вашого банку",
  333.         ];
  334.         return $statuses[$this->getStatus()];
  335.     }
  336.     public function getPaymentData(): ?string
  337.     {
  338.         return $this->paymentData;
  339.     }
  340.     public function setPaymentData(?string $paymentData): static
  341.     {
  342.         $this->paymentData $paymentData;
  343.         return $this;
  344.     }
  345.     public function getIdReceipt(): ?string
  346.     {
  347.         return $this->idReceipt;
  348.     }
  349.     public function setIdReceipt(?string $idReceipt): static
  350.     {
  351.         $this->idReceipt $idReceipt;
  352.         return $this;
  353.     }
  354.     public function getOrderToken(): ?string
  355.     {
  356.         return $this->orderToken;
  357.     }
  358.     public function setOrderToken(?string $orderToken): static
  359.     {
  360.         $this->orderToken $orderToken;
  361.         return $this;
  362.     }
  363.     public function getDiscount()
  364.     {
  365.         return $this->discount;
  366.     }
  367.     public function setDiscount($discount): static
  368.     {
  369.         $this->discount $discount;
  370.         return $this;
  371.     }
  372.     public function getDiscountName(): ?string
  373.     {
  374.         return $this->discountName;
  375.     }
  376.     public function setDiscountName($discountName): static
  377.     {
  378.         $this->discountName $discountName;
  379.         return $this;
  380.     }
  381.     public function getMetaTags(): ?string
  382.     {
  383.         return $this->metaTags;
  384.     }
  385.     public function setMetaTags(?string $metaTags): static
  386.     {
  387.         $this->metaTags $metaTags;
  388.         return $this;
  389.     }
  390. }