src/Entity/Orders.php line 16
<?php
namespace App\Entity;
use App\Helper\AdminHelper;
use App\Repository\OrdersRepository;
use DateTime;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Exception;
#[ORM\Entity(repositoryClass: OrdersRepository::class)]
class Orders
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $fullName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $phone = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $address = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $postalCode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $city = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?DateTimeInterface $created = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
private ?string $total = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $pin = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $country = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $companyName = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $text = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $firstName = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $lastName = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?User $user = null;
#[ORM\Column(nullable: true)]
private ?bool $success = null;
#[ORM\Column(length: 255)]
private ?string $orderNumber = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?Product $product = null;
#[ORM\Column(nullable: true)]
private ?int $quantity = null;
#[ORM\Column(nullable: true)]
private ?bool $active = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $cardNumber = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $subscriptionExpDate = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $cardExpDate = null;
#[ORM\Column(nullable: true)]
private ?bool $cancelled = null;
#[ORM\Column(nullable: true)]
private ?bool $payOnce = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Bills $bill = null;
#[ORM\Column(nullable: true)]
private ?bool $virman = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?Offer $offer = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $contractNumber = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $contractFolderPath = null;
#[ORM\Column(nullable: true)]
private ?float $tax = null;
#[ORM\Column(nullable: true)]
private ?float $connectionFee = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $activationDate = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?SellerCode $sellerCode = null;
#[ORM\Column(nullable: true)]
private ?bool $lockContract = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $notice = null;
#[ORM\Column(length: 10, nullable: true)]
private ?string $freePeriod = null;
#[ORM\Column(nullable: true)]
private ?float $customPrice = null;
#[ORM\Column(nullable: true)]
private ?bool $connectWithPreviousOrder = null;
#[ORM\Column(nullable: true)]
private ?int $connectWithPreviousOrderId = null;
#[ORM\OneToMany(mappedBy: 'orders', targetEntity: InvoiceItem::class)]
private Collection $invoiceItems;
public function __construct()
{
$this->created = new DateTime();
$this->invoiceItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(?int $id): self
{
$this->id = $id;
return $this;
}
public function getFullName(): ?string
{
return $this->fullName;
}
public function setFullName(?string $fullName): self
{
$this->fullName = $fullName;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getCreated(): ?DateTimeInterface
{
return $this->created;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getTotal(): ?string
{
return $this->total;
}
public function setTotal(string $total): self
{
$this->total = $total;
return $this;
}
public function getPin(): ?string
{
return $this->pin;
}
public function setPin(?string $pin): self
{
$this->pin = $pin;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(?string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function isSuccess(): ?bool
{
return $this->success;
}
public function setSuccess(?bool $success): self
{
$this->success = $success;
return $this;
}
public function getOrderNumber(): ?string
{
return $this->orderNumber;
}
public function getHashedOrderNumber(): ?string
{
return base64_encode($this->orderNumber);
}
public function setOrderNumber(string $orderNumber): self
{
$this->orderNumber = $orderNumber;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(?int $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(?bool $active): self
{
$this->active = $active;
return $this;
}
public function getCardNumber(): ?string
{
return $this->cardNumber;
}
public function setCardNumber(?string $cardNumber): self
{
$this->cardNumber = $cardNumber;
return $this;
}
public function getSubscriptionExpDate(): ?DateTimeInterface
{
return $this->subscriptionExpDate;
}
public function setSubscriptionExpDate(?DateTimeInterface $subscriptionExpDate): self
{
$this->subscriptionExpDate = $subscriptionExpDate;
return $this;
}
public function getCardExpDate(): ?DateTimeInterface
{
return $this->cardExpDate;
}
public function setCardExpDate(?DateTimeInterface $cardExpDate): self
{
$this->cardExpDate = $cardExpDate;
return $this;
}
public function isCancelled(): ?bool
{
return $this->cancelled;
}
public function setCancelled(?bool $cancelled): self
{
$this->cancelled = $cancelled;
return $this;
}
public function isPayOnce(): ?bool
{
return $this->payOnce;
}
public function setPayOnce(?bool $payOnce): self
{
$this->payOnce = $payOnce;
return $this;
}
public function getBill(): ?Bills
{
return $this->bill;
}
public function setBill(?Bills $bill): self
{
$this->bill = $bill;
return $this;
}
public function isVirman(): ?bool
{
return $this->virman;
}
public function setVirman(?bool $virman): self
{
$this->virman = $virman;
return $this;
}
public function getOffer(): ?Offer
{
return $this->offer;
}
public function setOffer(?Offer $offer): self
{
$this->offer = $offer;
return $this;
}
public function getContractNumber(): ?string
{
return $this->contractNumber;
}
public function setContractNumber(?string $contractNumber): self
{
$this->contractNumber = $contractNumber;
return $this;
}
public function getContractFolderPath(): ?string
{
return $this->contractFolderPath;
}
public function setContractFolderPath(?string $contractFolderPath): self
{
$this->contractFolderPath = $contractFolderPath;
return $this;
}
public function getTax(): ?float
{
return $this->tax;
}
public function setTax(?float $tax): self
{
$this->tax = $tax;
return $this;
}
public function getConnectionFee(): ?float
{
return $this->connectionFee;
}
public function setConnectionFee(?float $connectionFee): self
{
$this->connectionFee = $connectionFee;
return $this;
}
public function getActivationDate(): ?DateTimeInterface
{
return $this->activationDate;
}
public function setActivationDate(?DateTimeInterface $activationDate): self
{
$this->activationDate = $activationDate;
return $this;
}
public function getSellerCode(): ?SellerCode
{
return $this->sellerCode;
}
public function setSellerCode(?SellerCode $sellerCode): self
{
$this->sellerCode = $sellerCode;
return $this;
}
public function isLockContract(): ?bool
{
return $this->lockContract;
}
public function setLockContract(?bool $lockContract): self
{
$this->lockContract = $lockContract;
return $this;
}
public function getNotice(): ?string
{
return $this->notice;
}
public function setNotice(?string $notice): self
{
$this->notice = $notice;
return $this;
}
public function getFreePeriod(): ?string
{
return $this->freePeriod;
}
public function setFreePeriod(?string $freePeriod): self
{
$this->freePeriod = $freePeriod;
return $this;
}
/**
* @throws Exception
*/
public function getEndOfFreePeriod(): ?\DateTimeInterface
{
if ($this->activationDate instanceof \DateTimeInterface && $this->freePeriod) {
$mjeseci = (int)$this->freePeriod; // Pretvaranje "3M" u broj mjeseci
$endDate = clone $this->activationDate;
$endDate->add(new \DateInterval('P' . $mjeseci . 'M')); // Dodavanje određenog broja mjeseci
return $endDate;
}
return null;
}
public function getCustomPrice(): ?float
{
return $this->customPrice;
}
public function setCustomPrice(?float $customPrice): static
{
$this->customPrice = $customPrice;
return $this;
}
public function isConnectWithPreviousOrder(): ?bool
{
return $this->connectWithPreviousOrder;
}
public function setConnectWithPreviousOrder(?bool $connectWithPreviousOrder): static
{
$this->connectWithPreviousOrder = $connectWithPreviousOrder;
return $this;
}
public function getConnectWithPreviousOrderId(): ?int
{
return $this->connectWithPreviousOrderId;
}
public function setConnectWithPreviousOrderId(?int $connectWithPreviousOrderId): static
{
$this->connectWithPreviousOrderId = $connectWithPreviousOrderId;
return $this;
}
/**
* @return Collection<int, InvoiceItem>
*/
public function getInvoiceItems(): Collection
{
return $this->invoiceItems;
}
public function addInvoiceItem(InvoiceItem $invoiceItem): static
{
if (!$this->invoiceItems->contains($invoiceItem)) {
$this->invoiceItems->add($invoiceItem);
$invoiceItem->setOrders($this);
}
return $this;
}
public function removeInvoiceItem(InvoiceItem $invoiceItem): static
{
if ($this->invoiceItems->removeElement($invoiceItem)) {
// set the owning side to null (unless already changed)
if ($invoiceItem->getOrders() === $this) {
$invoiceItem->setOrders(null);
}
}
return $this;
}
}