src/Entity/ServiceRequest.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServiceRequestRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ServiceRequestRepository::class)
  10.  */
  11. class ServiceRequest
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="serviceRequests")
  21.      * @ORM\JoinColumn(nullable=false)
  22.      */
  23.     private $customer;
  24.     /**
  25.      * @var DateTimeImmutable
  26.      * @ORM\Column(type="datetimetz_immutable")
  27.      */
  28.     private $dateCreated;
  29.     /**
  30.      * @var DateTimeImmutable|null
  31.      * @ORM\Column(type="datetimetz_immutable", nullable=true)
  32.      */
  33.     private $realizationDate;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private $isNewRequest true;
  38.     /**
  39.      * @ORM\Column(type="boolean")
  40.      */
  41.     private $isInvoiceDeliveryPost;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $invoiceDeliveryEmail;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      */
  49.     private $locationName;
  50.     /**
  51.      * @ORM\Column(type="string", length=255)
  52.      */
  53.     private $locationAddress;
  54.     /**
  55.      * @ORM\Column(type="string", length=255)
  56.      */
  57.     private $locationCity;
  58.     /**
  59.      * @ORM\Column(type="string", length=5)
  60.      */
  61.     private $locationPostalCode;
  62.     /**
  63.      * @var string
  64.      * @ORM\Column(type="string")
  65.      */
  66.     private $paymentMethod;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      */
  70.     private $contactTitle;
  71.     /**
  72.      * @ORM\Column(type="string", length=255)
  73.      */
  74.     private $contactFirstName;
  75.     /**
  76.      * @ORM\Column(type="string", length=255)
  77.      */
  78.     private $contactLastName;
  79.     /**
  80.      * @ORM\Column(type="string", length=255, nullable=true)
  81.      */
  82.     private $contactPhone;
  83.     /**
  84.      * @ORM\Column(type="boolean")
  85.      */
  86.     private $voipEnabled;
  87.     /**
  88.      * @ORM\Column(type="bigint")
  89.      */
  90.     private $voipMonthlyFee 0;
  91.     /**
  92.      * @ORM\Column(type="bigint")
  93.      */
  94.     private $voipConnectionFee 0;
  95.     /**
  96.      * @ORM\Column(type="boolean")
  97.      */
  98.     private $terminalEquipmentLease;
  99.     /**
  100.      * @ORM\Column(type="bigint")
  101.      */
  102.     private $voipChannels;
  103.     /**
  104.      * @ORM\Column(type="bigint")
  105.      */
  106.     private $fax2mailChannels;
  107.     /**
  108.      * @ORM\Column(type="string", length=255)
  109.      */
  110.     private $phoneNumeration;
  111.     /**
  112.      * @ORM\Column(type="string", length=255)
  113.      */
  114.     private $faxNumeration;
  115.     /**
  116.      * @ORM\Column(type="boolean")
  117.      */
  118.     private $fax2mailEnabled;
  119.     /**
  120.      * @ORM\Column(type="string", length=255)
  121.      */
  122.     private $fax2mailEmail;
  123.     /**
  124.      * @ORM\Column(type="boolean")
  125.      */
  126.     private $phoneNumberTransfer;
  127.     /**
  128.      * @ORM\Column(type="boolean")
  129.      */
  130.     private $internetAccessEnabled;
  131.     /**
  132.      * @ORM\ManyToMany(targetEntity=InternetOption::class)
  133.      */
  134.     private $internetOptions;
  135.     /**
  136.      * @var int|null
  137.      * @ORM\Column(type="bigint", nullable=true)
  138.      */
  139.     private $internetOptionsPrice 0;
  140.     /**
  141.      * @var int|null
  142.      * @ORM\Column(type="bigint", nullable=true)
  143.      */
  144.     private $internetConnectionFee 0;
  145.     /**
  146.      * @var int
  147.      * @ORM\Column(type="bigint")
  148.      */
  149.     private $totalPrice 0;
  150.     /**
  151.      * @ORM\Column(type="boolean")
  152.      */
  153.     private $contractIndefinite true;
  154.     /**
  155.      * @ORM\Column(type="string", length=255)
  156.      */
  157.     private $contractOfferNo;
  158.     /**
  159.      * @ORM\Column(type="bigint", length=255)
  160.      */
  161.     private $contractDuration;
  162.     /**
  163.      * @ORM\Column(name="locked", type="boolean")
  164.      */
  165.     private $isLocked false;
  166.     /**
  167.      * @ORM\ManyToOne(targetEntity=Operator::class)
  168.      * @ORM\JoinColumn(nullable=false)
  169.      */
  170.     private $operator;
  171.     /**
  172.      * @var string
  173.      * @ORM\Column(type="text", nullable=true)
  174.      */
  175.     private $internalNote '';
  176.     /**
  177.      * @var string
  178.      * @ORM\Column(type="string")
  179.      */
  180.     private $requestNumber '';
  181.     public function __construct()
  182.     {
  183.         $this->internetOptions = new ArrayCollection();
  184.         if ($this->dateCreated === null) {
  185.             $this->dateCreated = new DateTimeImmutable();
  186.         }
  187.         if ($this->realizationDate === null) {
  188.             $this->realizationDate = new DateTimeImmutable('tomorrow');
  189.         }
  190.     }
  191.     public function getId(): ?int
  192.     {
  193.         return $this->id;
  194.     }
  195.     /**
  196.      * @return DateTimeImmutable
  197.      */
  198.     public function getDateCreated(): DateTimeImmutable
  199.     {
  200.         return $this->dateCreated;
  201.     }
  202.     /**
  203.      * @param DateTimeImmutable $dateCreated
  204.      *
  205.      * @return ServiceRequest
  206.      */
  207.     public function setDateCreated(DateTimeImmutable $dateCreated): ServiceRequest
  208.     {
  209.         $this->dateCreated $dateCreated;
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return DateTimeImmutable|null
  214.      */
  215.     public function getRealizationDate(): ?DateTimeImmutable
  216.     {
  217.         return $this->realizationDate;
  218.     }
  219.     /**
  220.      * @param DateTimeImmutable|null $realizationDate
  221.      *
  222.      * @return ServiceRequest
  223.      */
  224.     public function setRealizationDate(?DateTimeImmutable $realizationDate): ServiceRequest
  225.     {
  226.         $this->realizationDate $realizationDate;
  227.         return $this;
  228.     }
  229.     public function getCustomer(): ?Customer
  230.     {
  231.         return $this->customer;
  232.     }
  233.     public function setCustomer(?Customer $customer): self
  234.     {
  235.         $this->customer $customer;
  236.         return $this;
  237.     }
  238.     public function getIsNewRequest(): ?bool
  239.     {
  240.         return $this->isNewRequest;
  241.     }
  242.     public function setIsNewRequest(bool $isNewRequest): self
  243.     {
  244.         $this->isNewRequest $isNewRequest;
  245.         return $this;
  246.     }
  247.     public function getIsInvoiceDeliveryPost(): ?bool
  248.     {
  249.         return $this->isInvoiceDeliveryPost;
  250.     }
  251.     public function setIsInvoiceDeliveryPost(bool $isInvoiceDeliveryPost): self
  252.     {
  253.         $this->isInvoiceDeliveryPost $isInvoiceDeliveryPost;
  254.         return $this;
  255.     }
  256.     public function getInvoiceDeliveryEmail(): ?string
  257.     {
  258.         return $this->invoiceDeliveryEmail;
  259.     }
  260.     public function setInvoiceDeliveryEmail(?string $invoiceDeliveryEmail): self
  261.     {
  262.         $this->invoiceDeliveryEmail $invoiceDeliveryEmail;
  263.         return $this;
  264.     }
  265.     public function getLocationName(): ?string
  266.     {
  267.         return $this->locationName;
  268.     }
  269.     public function setLocationName(string $locationName): self
  270.     {
  271.         $this->locationName $locationName;
  272.         return $this;
  273.     }
  274.     public function getLocationAddress(): ?string
  275.     {
  276.         return $this->locationAddress;
  277.     }
  278.     public function setLocationAddress(string $locationAddress): self
  279.     {
  280.         $this->locationAddress $locationAddress;
  281.         return $this;
  282.     }
  283.     public function getLocationCity(): ?string
  284.     {
  285.         return $this->locationCity;
  286.     }
  287.     public function setLocationCity(string $locationCity): self
  288.     {
  289.         $this->locationCity $locationCity;
  290.         return $this;
  291.     }
  292.     public function getLocationPostalCode(): ?string
  293.     {
  294.         return $this->locationPostalCode;
  295.     }
  296.     public function setLocationPostalCode(string $locationPostalCode): self
  297.     {
  298.         $this->locationPostalCode $locationPostalCode;
  299.         return $this;
  300.     }
  301.     public function getPaymentMethod(): ?string
  302.     {
  303.         return $this->paymentMethod;
  304.     }
  305.     public function setPaymentMethod(string $paymentMethod): self
  306.     {
  307.         $this->paymentMethod $paymentMethod;
  308.         return $this;
  309.     }
  310.     public function getContactTitle(): ?string
  311.     {
  312.         return $this->contactTitle;
  313.     }
  314.     public function setContactTitle(string $contactTitle): self
  315.     {
  316.         $this->contactTitle $contactTitle;
  317.         return $this;
  318.     }
  319.     public function getContactFirstName(): ?string
  320.     {
  321.         return $this->contactFirstName;
  322.     }
  323.     public function setContactFirstName(string $contactFirstName): self
  324.     {
  325.         $this->contactFirstName $contactFirstName;
  326.         return $this;
  327.     }
  328.     public function getContactLastName(): ?string
  329.     {
  330.         return $this->contactLastName;
  331.     }
  332.     public function setContactLastName(string $contactLastName): self
  333.     {
  334.         $this->contactLastName $contactLastName;
  335.         return $this;
  336.     }
  337.     public function getContactPhone(): ?string
  338.     {
  339.         return $this->contactPhone;
  340.     }
  341.     public function setContactPhone(?string $contactPhone): self
  342.     {
  343.         $this->contactPhone $contactPhone;
  344.         return $this;
  345.     }
  346.     public function getVoipEnabled(): ?bool
  347.     {
  348.         return $this->voipEnabled;
  349.     }
  350.     public function setVoipEnabled(bool $voipEnabled): self
  351.     {
  352.         $this->voipEnabled $voipEnabled;
  353.         return $this;
  354.     }
  355.     public function getVoipMonthlyFee(): ?int
  356.     {
  357.         return $this->voipMonthlyFee;
  358.     }
  359.     public function setVoipMonthlyFee(int $voipMonthlyFee): self
  360.     {
  361.         $this->voipMonthlyFee $voipMonthlyFee;
  362.         return $this;
  363.     }
  364.     public function getVoipConnectionFee(): ?string
  365.     {
  366.         return $this->voipConnectionFee;
  367.     }
  368.     public function setVoipConnectionFee(string $voipConnectionFee): self
  369.     {
  370.         $this->voipConnectionFee $voipConnectionFee;
  371.         return $this;
  372.     }
  373.     public function getTerminalEquipmentLease(): ?bool
  374.     {
  375.         return $this->terminalEquipmentLease;
  376.     }
  377.     public function setTerminalEquipmentLease(bool $terminalEquipmentLease): self
  378.     {
  379.         $this->terminalEquipmentLease $terminalEquipmentLease;
  380.         return $this;
  381.     }
  382.     public function getVoipChannels(): ?string
  383.     {
  384.         return $this->voipChannels;
  385.     }
  386.     public function setVoipChannels(string $voipChannels): self
  387.     {
  388.         $this->voipChannels $voipChannels;
  389.         return $this;
  390.     }
  391.     public function getFax2mailChannels(): ?string
  392.     {
  393.         return $this->fax2mailChannels;
  394.     }
  395.     public function setFax2mailChannels(string $fax2mailChannels): self
  396.     {
  397.         $this->fax2mailChannels $fax2mailChannels;
  398.         return $this;
  399.     }
  400.     public function getPhoneNumeration(): ?string
  401.     {
  402.         return $this->phoneNumeration;
  403.     }
  404.     public function setPhoneNumeration(string $phoneNumeration): self
  405.     {
  406.         $this->phoneNumeration $phoneNumeration;
  407.         return $this;
  408.     }
  409.     public function getFaxNumeration(): ?string
  410.     {
  411.         return $this->faxNumeration;
  412.     }
  413.     public function setFaxNumeration(string $faxNumeration): self
  414.     {
  415.         $this->faxNumeration $faxNumeration;
  416.         return $this;
  417.     }
  418.     public function getFax2mailEnabled(): ?bool
  419.     {
  420.         return $this->fax2mailEnabled;
  421.     }
  422.     public function setFax2mailEnabled(bool $fax2mailEnabled): self
  423.     {
  424.         $this->fax2mailEnabled $fax2mailEnabled;
  425.         return $this;
  426.     }
  427.     public function getFax2mailEmail(): ?string
  428.     {
  429.         return $this->fax2mailEmail;
  430.     }
  431.     public function setFax2mailEmail(string $fax2mailEmail): self
  432.     {
  433.         $this->fax2mailEmail $fax2mailEmail;
  434.         return $this;
  435.     }
  436.     public function getPhoneNumberTransfer(): ?bool
  437.     {
  438.         return $this->phoneNumberTransfer;
  439.     }
  440.     public function setPhoneNumberTransfer(bool $phoneNumberTransfer): self
  441.     {
  442.         $this->phoneNumberTransfer $phoneNumberTransfer;
  443.         return $this;
  444.     }
  445.     public function getInternetAccessEnabled(): ?bool
  446.     {
  447.         return $this->internetAccessEnabled;
  448.     }
  449.     public function setInternetAccessEnabled(bool $internetAccessEnabled): self
  450.     {
  451.         $this->internetAccessEnabled $internetAccessEnabled;
  452.         return $this;
  453.     }
  454.     /**
  455.      * @return Collection|InternetOption[]
  456.      */
  457.     public function getInternetOptions(): Collection
  458.     {
  459.         return $this->internetOptions;
  460.     }
  461.     public function addInternetOption(InternetOption $internetOption): self
  462.     {
  463.         if (!$this->internetOptions->contains($internetOption)) {
  464.             $this->internetOptions[] = $internetOption;
  465.         }
  466.         return $this;
  467.     }
  468.     public function removeInternetOption(InternetOption $internetOption): self
  469.     {
  470.         if ($this->internetOptions->contains($internetOption)) {
  471.             $this->internetOptions->removeElement($internetOption);
  472.         }
  473.         return $this;
  474.     }
  475.     public function getContractIndefinite(): ?bool
  476.     {
  477.         return $this->contractIndefinite;
  478.     }
  479.     public function setContractIndefinite(bool $contractIndefinite): self
  480.     {
  481.         $this->contractIndefinite $contractIndefinite;
  482.         return $this;
  483.     }
  484.     public function getContractOfferNo(): ?string
  485.     {
  486.         return $this->contractOfferNo;
  487.     }
  488.     public function setContractOfferNo(string $contractOfferNo): self
  489.     {
  490.         $this->contractOfferNo $contractOfferNo;
  491.         return $this;
  492.     }
  493.     public function getContractDuration(): ?int
  494.     {
  495.         return $this->contractDuration;
  496.     }
  497.     public function setContractDuration(int $contractDuration): self
  498.     {
  499.         $this->contractDuration $contractDuration;
  500.         return $this;
  501.     }
  502.     public function isLocked(): ?bool
  503.     {
  504.         return $this->isLocked;
  505.     }
  506.     public function setLocked(bool $isLocked): self
  507.     {
  508.         $this->isLocked $isLocked;
  509.         return $this;
  510.     }
  511.     public function getOperator(): ?Operator
  512.     {
  513.         return $this->operator;
  514.     }
  515.     public function setOperator(?Operator $operator): self
  516.     {
  517.         $this->operator $operator;
  518.         return $this;
  519.     }
  520.     /**
  521.      * @return int|null
  522.      */
  523.     public function getInternetOptionsPrice(): ?int
  524.     {
  525.         if ($this->internetOptionsPrice === null && $this->internetOptions->count() > 0) {
  526.             $this->internetOptionsPrice array_sum(
  527.                 $this->internetOptions->map(
  528.                     static function (InternetOption $io) {
  529.                         return $io->getPrice();
  530.                     }
  531.                 )->toArray()
  532.             );
  533.         }
  534.         return $this->internetOptionsPrice;
  535.     }
  536.     /**
  537.      * @param int|null $internetOptionsPrice
  538.      *
  539.      * @return ServiceRequest
  540.      */
  541.     public function setInternetOptionsPrice(?int $internetOptionsPrice): ServiceRequest
  542.     {
  543.         $this->internetOptionsPrice $internetOptionsPrice;
  544.         return $this;
  545.     }
  546.     /**
  547.      * @return int|null
  548.      */
  549.     public function getInternetConnectionFee(): ?int
  550.     {
  551.         return $this->internetConnectionFee;
  552.     }
  553.     /**
  554.      * @param int|null $internetConnectionFee
  555.      *
  556.      * @return ServiceRequest
  557.      */
  558.     public function setInternetConnectionFee(?int $internetConnectionFee): ServiceRequest
  559.     {
  560.         $this->internetConnectionFee $internetConnectionFee;
  561.         return $this;
  562.     }
  563.     /**
  564.      * @return int
  565.      */
  566.     public function getTotalPrice(): int
  567.     {
  568.         return $this->totalPrice;
  569.     }
  570.     /**
  571.      * @param int $totalPrice
  572.      *
  573.      * @return ServiceRequest
  574.      */
  575.     public function setTotalPrice(int $totalPrice): ServiceRequest
  576.     {
  577.         $this->totalPrice $totalPrice;
  578.         return $this;
  579.     }
  580.     /**
  581.      * @return string
  582.      */
  583.     public function getInternalNote(): string
  584.     {
  585.         return $this->internalNote ?? '';
  586.     }
  587.     /**
  588.      * @param string $internalNote
  589.      *
  590.      * @return ServiceRequest
  591.      */
  592.     public function setInternalNote(?string $internalNote ''): ServiceRequest
  593.     {
  594.         $this->internalNote $internalNote;
  595.         return $this;
  596.     }
  597.     /**
  598.      * @return string
  599.      */
  600.     public function getRequestNumber(): string
  601.     {
  602.         return $this->requestNumber;
  603.     }
  604.     /**
  605.      * @param string $requestNumber
  606.      *
  607.      * @return ServiceRequest
  608.      */
  609.     public function setRequestNumber(string $requestNumber): ServiceRequest
  610.     {
  611.         $this->requestNumber $requestNumber;
  612.         return $this;
  613.     }
  614. }