src/Entity/Orders.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Helper\AdminHelper;
  4. use App\Repository\OrdersRepository;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Exception;
  12. #[ORM\Entity(repositoryClassOrdersRepository::class)]
  13. class Orders
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $fullName null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $email null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $phone null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $address null;
  27.     #[ORM\Column(length50nullabletrue)]
  28.     private ?string $postalCode null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $city null;
  31.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  32.     private ?DateTimeInterface $created null;
  33.     #[ORM\Column(typeTypes::DECIMALprecision10scale2)]
  34.     private ?string $total null;
  35.     #[ORM\Column(length50nullabletrue)]
  36.     private ?string $pin null;
  37.     #[ORM\Column(length50nullabletrue)]
  38.     private ?string $country null;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     private ?string $companyName null;
  41.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  42.     private ?string $text null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $firstName null;
  45.     #[ORM\Column(length100nullabletrue)]
  46.     private ?string $lastName null;
  47.     #[ORM\ManyToOne(inversedBy'orders')]
  48.     private ?User $user null;
  49.     #[ORM\Column(nullabletrue)]
  50.     private ?bool $success null;
  51.     #[ORM\Column(length255)]
  52.     private ?string $orderNumber null;
  53.     #[ORM\ManyToOne(inversedBy'orders')]
  54.     private ?Product $product null;
  55.     #[ORM\Column(nullabletrue)]
  56.     private ?int $quantity null;
  57.     #[ORM\Column(nullabletrue)]
  58.     private ?bool $active null;
  59.     #[ORM\Column(length255nullabletrue)]
  60.     private ?string $cardNumber null;
  61.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  62.     private ?DateTimeInterface $subscriptionExpDate null;
  63.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  64.     private ?DateTimeInterface $cardExpDate null;
  65.     #[ORM\Column(nullabletrue)]
  66.     private ?bool $cancelled null;
  67.     #[ORM\Column(nullabletrue)]
  68.     private ?bool $payOnce null;
  69.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  70.     private ?Bills $bill null;
  71.     #[ORM\Column(nullabletrue)]
  72.     private ?bool $virman null;
  73.     #[ORM\ManyToOne(inversedBy'orders')]
  74.     private ?Offer $offer null;
  75.     #[ORM\Column(length255nullabletrue)]
  76.     private ?string $contractNumber null;
  77.     #[ORM\Column(length255nullabletrue)]
  78.     private ?string $contractFolderPath null;
  79.     #[ORM\Column(nullabletrue)]
  80.     private ?float $tax null;
  81.     #[ORM\Column(nullabletrue)]
  82.     private ?float $connectionFee null;
  83.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  84.     private ?DateTimeInterface $activationDate null;
  85.     #[ORM\ManyToOne(inversedBy'orders')]
  86.     private ?SellerCode $sellerCode null;
  87.     #[ORM\Column(nullabletrue)]
  88.     private ?bool $lockContract null;
  89.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  90.     private ?string $notice null;
  91.     #[ORM\Column(length10nullabletrue)]
  92.     private ?string $freePeriod null;
  93.     #[ORM\Column(nullabletrue)]
  94.     private ?float $customPrice null;
  95.     #[ORM\Column(nullabletrue)]
  96.     private ?bool $connectWithPreviousOrder null;
  97.     #[ORM\Column(nullabletrue)]
  98.     private ?int $connectWithPreviousOrderId null;
  99.     #[ORM\OneToMany(mappedBy'orders'targetEntityInvoiceItem::class)]
  100.     private Collection $invoiceItems;
  101.     public function __construct()
  102.     {
  103.         $this->created = new DateTime();
  104.         $this->invoiceItems = new ArrayCollection();
  105.     }
  106.     public function getId(): ?int
  107.     {
  108.         return $this->id;
  109.     }
  110.     public function setId(?int $id): self
  111.     {
  112.         $this->id $id;
  113.         return $this;
  114.     }
  115.     public function getFullName(): ?string
  116.     {
  117.         return $this->fullName;
  118.     }
  119.     public function setFullName(?string $fullName): self
  120.     {
  121.         $this->fullName $fullName;
  122.         return $this;
  123.     }
  124.     public function getEmail(): ?string
  125.     {
  126.         return $this->email;
  127.     }
  128.     public function setEmail(?string $email): self
  129.     {
  130.         $this->email $email;
  131.         return $this;
  132.     }
  133.     public function getPhone(): ?string
  134.     {
  135.         return $this->phone;
  136.     }
  137.     public function setPhone(?string $phone): self
  138.     {
  139.         $this->phone $phone;
  140.         return $this;
  141.     }
  142.     public function getAddress(): ?string
  143.     {
  144.         return $this->address;
  145.     }
  146.     public function setAddress(?string $address): self
  147.     {
  148.         $this->address $address;
  149.         return $this;
  150.     }
  151.     public function getPostalCode(): ?string
  152.     {
  153.         return $this->postalCode;
  154.     }
  155.     public function setPostalCode(?string $postalCode): self
  156.     {
  157.         $this->postalCode $postalCode;
  158.         return $this;
  159.     }
  160.     public function getCity(): ?string
  161.     {
  162.         return $this->city;
  163.     }
  164.     public function setCity(?string $city): self
  165.     {
  166.         $this->city $city;
  167.         return $this;
  168.     }
  169.     public function getCreated(): ?DateTimeInterface
  170.     {
  171.         return $this->created;
  172.     }
  173.     public function setCreated(DateTimeInterface $created): self
  174.     {
  175.         $this->created $created;
  176.         return $this;
  177.     }
  178.     public function getTotal(): ?string
  179.     {
  180.         return $this->total;
  181.     }
  182.     public function setTotal(string $total): self
  183.     {
  184.         $this->total $total;
  185.         return $this;
  186.     }
  187.     public function getPin(): ?string
  188.     {
  189.         return $this->pin;
  190.     }
  191.     public function setPin(?string $pin): self
  192.     {
  193.         $this->pin $pin;
  194.         return $this;
  195.     }
  196.     public function getCountry(): ?string
  197.     {
  198.         return $this->country;
  199.     }
  200.     public function setCountry(?string $country): self
  201.     {
  202.         $this->country $country;
  203.         return $this;
  204.     }
  205.     public function getCompanyName(): ?string
  206.     {
  207.         return $this->companyName;
  208.     }
  209.     public function setCompanyName(?string $companyName): self
  210.     {
  211.         $this->companyName $companyName;
  212.         return $this;
  213.     }
  214.     public function getText(): ?string
  215.     {
  216.         return $this->text;
  217.     }
  218.     public function setText(?string $text): self
  219.     {
  220.         $this->text $text;
  221.         return $this;
  222.     }
  223.     public function getFirstName(): ?string
  224.     {
  225.         return $this->firstName;
  226.     }
  227.     public function setFirstName(?string $firstName): self
  228.     {
  229.         $this->firstName $firstName;
  230.         return $this;
  231.     }
  232.     public function getLastName(): ?string
  233.     {
  234.         return $this->lastName;
  235.     }
  236.     public function setLastName(?string $lastName): self
  237.     {
  238.         $this->lastName $lastName;
  239.         return $this;
  240.     }
  241.     public function getUser(): ?User
  242.     {
  243.         return $this->user;
  244.     }
  245.     public function setUser(?User $user): self
  246.     {
  247.         $this->user $user;
  248.         return $this;
  249.     }
  250.     public function isSuccess(): ?bool
  251.     {
  252.         return $this->success;
  253.     }
  254.     public function setSuccess(?bool $success): self
  255.     {
  256.         $this->success $success;
  257.         return $this;
  258.     }
  259.     public function getOrderNumber(): ?string
  260.     {
  261.         return $this->orderNumber;
  262.     }
  263.     public function getHashedOrderNumber(): ?string
  264.     {
  265.         return base64_encode($this->orderNumber);
  266.     }
  267.     public function setOrderNumber(string $orderNumber): self
  268.     {
  269.         $this->orderNumber $orderNumber;
  270.         return $this;
  271.     }
  272.     public function getProduct(): ?Product
  273.     {
  274.         return $this->product;
  275.     }
  276.     public function setProduct(?Product $product): self
  277.     {
  278.         $this->product $product;
  279.         return $this;
  280.     }
  281.     public function getQuantity(): ?int
  282.     {
  283.         return $this->quantity;
  284.     }
  285.     public function setQuantity(?int $quantity): self
  286.     {
  287.         $this->quantity $quantity;
  288.         return $this;
  289.     }
  290.     public function isActive(): ?bool
  291.     {
  292.         return $this->active;
  293.     }
  294.     public function setActive(?bool $active): self
  295.     {
  296.         $this->active $active;
  297.         return $this;
  298.     }
  299.     public function getCardNumber(): ?string
  300.     {
  301.         return $this->cardNumber;
  302.     }
  303.     public function setCardNumber(?string $cardNumber): self
  304.     {
  305.         $this->cardNumber $cardNumber;
  306.         return $this;
  307.     }
  308.     public function getSubscriptionExpDate(): ?DateTimeInterface
  309.     {
  310.         return $this->subscriptionExpDate;
  311.     }
  312.     public function setSubscriptionExpDate(?DateTimeInterface $subscriptionExpDate): self
  313.     {
  314.         $this->subscriptionExpDate $subscriptionExpDate;
  315.         return $this;
  316.     }
  317.     public function getCardExpDate(): ?DateTimeInterface
  318.     {
  319.         return $this->cardExpDate;
  320.     }
  321.     public function setCardExpDate(?DateTimeInterface $cardExpDate): self
  322.     {
  323.         $this->cardExpDate $cardExpDate;
  324.         return $this;
  325.     }
  326.     public function isCancelled(): ?bool
  327.     {
  328.         return $this->cancelled;
  329.     }
  330.     public function setCancelled(?bool $cancelled): self
  331.     {
  332.         $this->cancelled $cancelled;
  333.         return $this;
  334.     }
  335.     public function isPayOnce(): ?bool
  336.     {
  337.         return $this->payOnce;
  338.     }
  339.     public function setPayOnce(?bool $payOnce): self
  340.     {
  341.         $this->payOnce $payOnce;
  342.         return $this;
  343.     }
  344.     public function getBill(): ?Bills
  345.     {
  346.         return $this->bill;
  347.     }
  348.     public function setBill(?Bills $bill): self
  349.     {
  350.         $this->bill $bill;
  351.         return $this;
  352.     }
  353.     public function isVirman(): ?bool
  354.     {
  355.         return $this->virman;
  356.     }
  357.     public function setVirman(?bool $virman): self
  358.     {
  359.         $this->virman $virman;
  360.         return $this;
  361.     }
  362.     public function getOffer(): ?Offer
  363.     {
  364.         return $this->offer;
  365.     }
  366.     public function setOffer(?Offer $offer): self
  367.     {
  368.         $this->offer $offer;
  369.         return $this;
  370.     }
  371.     public function getContractNumber(): ?string
  372.     {
  373.         return $this->contractNumber;
  374.     }
  375.     public function setContractNumber(?string $contractNumber): self
  376.     {
  377.         $this->contractNumber $contractNumber;
  378.         return $this;
  379.     }
  380.     public function getContractFolderPath(): ?string
  381.     {
  382.         return $this->contractFolderPath;
  383.     }
  384.     public function setContractFolderPath(?string $contractFolderPath): self
  385.     {
  386.         $this->contractFolderPath $contractFolderPath;
  387.         return $this;
  388.     }
  389.     public function getTax(): ?float
  390.     {
  391.         return $this->tax;
  392.     }
  393.     public function setTax(?float $tax): self
  394.     {
  395.         $this->tax $tax;
  396.         return $this;
  397.     }
  398.     public function getConnectionFee(): ?float
  399.     {
  400.         return $this->connectionFee;
  401.     }
  402.     public function setConnectionFee(?float $connectionFee): self
  403.     {
  404.         $this->connectionFee $connectionFee;
  405.         return $this;
  406.     }
  407.     public function getActivationDate(): ?DateTimeInterface
  408.     {
  409.         return $this->activationDate;
  410.     }
  411.     public function setActivationDate(?DateTimeInterface $activationDate): self
  412.     {
  413.         $this->activationDate $activationDate;
  414.         return $this;
  415.     }
  416.     public function getSellerCode(): ?SellerCode
  417.     {
  418.         return $this->sellerCode;
  419.     }
  420.     public function setSellerCode(?SellerCode $sellerCode): self
  421.     {
  422.         $this->sellerCode $sellerCode;
  423.         return $this;
  424.     }
  425.     public function isLockContract(): ?bool
  426.     {
  427.         return $this->lockContract;
  428.     }
  429.     public function setLockContract(?bool $lockContract): self
  430.     {
  431.         $this->lockContract $lockContract;
  432.         return $this;
  433.     }
  434.     public function getNotice(): ?string
  435.     {
  436.         return $this->notice;
  437.     }
  438.     public function setNotice(?string $notice): self
  439.     {
  440.         $this->notice $notice;
  441.         return $this;
  442.     }
  443.     public function getFreePeriod(): ?string
  444.     {
  445.         return $this->freePeriod;
  446.     }
  447.     public function setFreePeriod(?string $freePeriod): self
  448.     {
  449.         $this->freePeriod $freePeriod;
  450.         return $this;
  451.     }
  452.     /**
  453.      * @throws Exception
  454.      */
  455.     public function getEndOfFreePeriod(): ?\DateTimeInterface
  456.     {
  457.         if ($this->activationDate instanceof \DateTimeInterface && $this->freePeriod) {
  458.             $mjeseci = (int)$this->freePeriod// Pretvaranje "3M" u broj mjeseci
  459.             $endDate = clone $this->activationDate;
  460.             $endDate->add(new \DateInterval('P' $mjeseci 'M')); // Dodavanje odreÄ‘enog broja mjeseci
  461.             return $endDate;
  462.         }
  463.         return null;
  464.     }
  465.     public function getCustomPrice(): ?float
  466.     {
  467.         return $this->customPrice;
  468.     }
  469.     public function setCustomPrice(?float $customPrice): static
  470.     {
  471.         $this->customPrice $customPrice;
  472.         return $this;
  473.     }
  474.     public function isConnectWithPreviousOrder(): ?bool
  475.     {
  476.         return $this->connectWithPreviousOrder;
  477.     }
  478.     public function setConnectWithPreviousOrder(?bool $connectWithPreviousOrder): static
  479.     {
  480.         $this->connectWithPreviousOrder $connectWithPreviousOrder;
  481.         return $this;
  482.     }
  483.     public function getConnectWithPreviousOrderId(): ?int
  484.     {
  485.         return $this->connectWithPreviousOrderId;
  486.     }
  487.     public function setConnectWithPreviousOrderId(?int $connectWithPreviousOrderId): static
  488.     {
  489.         $this->connectWithPreviousOrderId $connectWithPreviousOrderId;
  490.         return $this;
  491.     }
  492.     /**
  493.      * @return Collection<int, InvoiceItem>
  494.      */
  495.     public function getInvoiceItems(): Collection
  496.     {
  497.         return $this->invoiceItems;
  498.     }
  499.     public function addInvoiceItem(InvoiceItem $invoiceItem): static
  500.     {
  501.         if (!$this->invoiceItems->contains($invoiceItem)) {
  502.             $this->invoiceItems->add($invoiceItem);
  503.             $invoiceItem->setOrders($this);
  504.         }
  505.         return $this;
  506.     }
  507.     public function removeInvoiceItem(InvoiceItem $invoiceItem): static
  508.     {
  509.         if ($this->invoiceItems->removeElement($invoiceItem)) {
  510.             // set the owning side to null (unless already changed)
  511.             if ($invoiceItem->getOrders() === $this) {
  512.                 $invoiceItem->setOrders(null);
  513.             }
  514.         }
  515.         return $this;
  516.     }
  517. }