src/Entity/InterestPaidoffReport.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InterestPaidoffReportRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=InterestPaidoffReportRepository::class)
  9.  */
  10. class InterestPaidoffReport
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="interestPaidoffReports")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private $company;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Product::class, inversedBy="interestPaidoffReports")
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $product;
  28.     /**
  29.      * @ORM\Column(type="date")
  30.      */
  31.     private $dateFrom;
  32.     /**
  33.      * @ORM\Column(type="date")
  34.      */
  35.     private $dateTo;
  36.     /**
  37.      * @ORM\Column(type="float")
  38.      */
  39.     private $totalRevenues;
  40.     /**
  41.      * @ORM\Column(type="float")
  42.      */
  43.     private $totalTax;
  44.     /**
  45.      * @ORM\Column(type="datetime")
  46.      */
  47.     private $created;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="interestPaidoffReports")
  50.      * @ORM\JoinColumn(nullable=false)
  51.      */
  52.     private $createdBy;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=InterestPaidoff::class, mappedBy="interestPaidoffReport", orphanRemoval=true, cascade={"persist"})
  55.      */
  56.     private $interestPaidoffs;
  57.     /**
  58.      * @ORM\Column(type="boolean")
  59.      */
  60.     private $deleted false;
  61.     public function __construct()
  62.     {
  63.         $this->interestPaidoffs = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getCompany(): ?Company
  70.     {
  71.         return $this->company;
  72.     }
  73.     public function setCompany(?Company $company): self
  74.     {
  75.         $this->company $company;
  76.         return $this;
  77.     }
  78.     public function getProduct(): ?Product
  79.     {
  80.         return $this->product;
  81.     }
  82.     public function setProduct(?Product $product): self
  83.     {
  84.         $this->product $product;
  85.         return $this;
  86.     }
  87.     public function getDateFrom(): ?\DateTimeInterface
  88.     {
  89.         return $this->dateFrom;
  90.     }
  91.     public function setDateFrom(\DateTimeInterface $dateFrom): self
  92.     {
  93.         $this->dateFrom $dateFrom;
  94.         return $this;
  95.     }
  96.     public function getDateTo(): ?\DateTimeInterface
  97.     {
  98.         return $this->dateTo;
  99.     }
  100.     public function setDateTo(\DateTimeInterface $dateTo): self
  101.     {
  102.         $this->dateTo $dateTo;
  103.         return $this;
  104.     }
  105.     public function getTotalRevenues(): ?float
  106.     {
  107.         return $this->totalRevenues;
  108.     }
  109.     public function setTotalRevenues(float $totalRevenues): self
  110.     {
  111.         $this->totalRevenues $totalRevenues;
  112.         return $this;
  113.     }
  114.     public function getTotalTax(): ?float
  115.     {
  116.         return $this->totalTax;
  117.     }
  118.     public function setTotalTax(float $totalTax): self
  119.     {
  120.         $this->totalTax $totalTax;
  121.         return $this;
  122.     }
  123.     public function getCreated(): ?\DateTimeInterface
  124.     {
  125.         return $this->created;
  126.     }
  127.     public function setCreated(\DateTimeInterface $created): self
  128.     {
  129.         $this->created $created;
  130.         return $this;
  131.     }
  132.     public function getCreatedBy(): ?User
  133.     {
  134.         return $this->createdBy;
  135.     }
  136.     public function setCreatedBy(?User $createdBy): self
  137.     {
  138.         $this->createdBy $createdBy;
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection<int, InterestPaidoff>
  143.      */
  144.     public function getInterestPaidoffs(): Collection
  145.     {
  146.         return $this->interestPaidoffs;
  147.     }
  148.     public function addInterestPaidoff(InterestPaidoff $interestPaidoff): self
  149.     {
  150.         if (!$this->interestPaidoffs->contains($interestPaidoff)) {
  151.             $this->interestPaidoffs[] = $interestPaidoff;
  152.             $interestPaidoff->setInterestPaidoffReport($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeInterestPaidoff(InterestPaidoff $interestPaidoff): self
  157.     {
  158.         if ($this->interestPaidoffs->removeElement($interestPaidoff)) {
  159.             // set the owning side to null (unless already changed)
  160.             if ($interestPaidoff->getInterestPaidoffReport() === $this) {
  161.                 $interestPaidoff->setInterestPaidoffReport(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return int
  168.      */
  169.     public function getDays(\DateTimeInterface $fromDateTime\DateTimeInterface $toDateTime)
  170.     {
  171.         if ($fromDateTime->format("U") <= $toDateTime->format("U")) {
  172.             $diff $fromDateTime->diff($toDateTime);
  173.             return (int)$diff->format('%a');
  174.         } else {
  175.             return -1;
  176.         }
  177.     }
  178.     public function isDeleted(): ?bool
  179.     {
  180.         return $this->deleted;
  181.     }
  182.     public function setDeleted(bool $deleted): self
  183.     {
  184.         $this->deleted $deleted;
  185.         return $this;
  186.     }
  187. }