src/Entity/Contract.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Base\AbstractTimestampableEntity;
  4. use App\Repository\ContractRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ContractRepository::class)
  10.  * @ORM\HasLifecycleCallbacks
  11.  */
  12. class Contract extends AbstractTimestampableEntity
  13. {
  14.     /**
  15.      * @ORM\ManyToOne(targetEntity=ProjectType::class, inversedBy="contracts")
  16.      * @ORM\JoinColumn(nullable=false)
  17.      */
  18.     private ProjectType $projectType;
  19.     /**
  20.      * @ORM\Column(type="string", length=20 )
  21.      */
  22.     private string $seria;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private ?string $nr;
  27.     /**
  28.      * @ORM\Column(type="date", nullable=true)
  29.      */
  30.     private ?\DateTime $dataDin;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="contracts")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private Company $company;
  36.     /**
  37.      * @ORM\Column(type="text", nullable=true)
  38.      */
  39.     private ?string $contracTxt;
  40.     /**
  41.      * @ORM\Column(type="text", nullable=true)
  42.      */
  43.     private ?string $anexa;
  44.     /**
  45.      * @ORM\Column(type="date", nullable=true)
  46.      */
  47.     private ?\DateTime $startDate;
  48.     /**
  49.      * @ORM\Column(type="date", nullable=true)
  50.      */
  51.     private ?\DateTime $endDate;
  52.     /**
  53.      * @ORM\Column(type="decimal", precision=20, scale=2, nullable=true)
  54.      */
  55.     private ?float $totalPaid;
  56.     /**
  57.      * @ORM\Column(type="decimal", precision=20, scale=2, nullable=true)
  58.      */
  59.     private ?float $unitPrice;
  60.     /**
  61.      * @ORM\Column(type="integer", nullable=true)
  62.      */
  63.     private ?float $intervalOfUnitPrice;
  64.     /**
  65.      * @ORM\Column(type="integer", nullable=true)
  66.      */
  67.     private $durationMounth;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=Tranche::class, mappedBy="contract")
  70.      */
  71.     private $tranches;
  72.     /**
  73.      * @ORM\ManyToOne(targetEntity=ContractStatus::class)
  74.      * @ORM\JoinColumn(nullable=false)
  75.      */
  76.     private $contractStatus;
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity=Project::class, inversedBy="contracts")
  79.      * @ORM\JoinColumn(nullable=false)
  80.      */
  81.     private $project;
  82.     /**
  83.      * @ORM\Column(type="boolean")
  84.      */
  85.     private $indefinite;
  86.     /**
  87.      * @ORM\ManyToOne(targetEntity=Currency::class)
  88.      * @ORM\JoinColumn(nullable=false)
  89.      */
  90.     private $currency;
  91.     /**
  92.      * @ORM\Column(type="decimal", precision=10, scale=6)
  93.      */
  94.     private $exchangeRate;
  95.     /**
  96.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  97.      */
  98.     private ?float $hourlyRate;
  99.     /**
  100.      * @ORM\Column(type="integer", nullable=true)
  101.      */
  102.     private ?int $contractedHour;
  103.     /**
  104.      * @ORM\ManyToOne(targetEntity=Contract::class, inversedBy="contracts")
  105.      */
  106.     private ?Contract $contractParent;
  107.     /**
  108.      * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="contractParent")
  109.      */
  110.     private $contracts;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity=Language::class)
  113.      * @ORM\JoinColumn(nullable=true)
  114.      */
  115.     private ?Language $language;
  116.     /**
  117.      * @ORM\Column(type="decimal", precision=21, scale=2, nullable=true)
  118.      */
  119.     private $contractParentValue;
  120.     public function __construct()
  121.     {
  122.         $this->receptionHeaders = new ArrayCollection();
  123.         $this->contractPaymentTranches = new ArrayCollection();
  124.         $this->tranches = new ArrayCollection();
  125.         $this->contracts = new ArrayCollection();
  126.     }
  127.     public function getProjectType(): ProjectType
  128.     {
  129.         return $this->projectType;
  130.     }
  131.     public function setProjectType(ProjectType $projectType): void
  132.     {
  133.         $this->projectType $projectType;
  134.     }
  135.     public function getSeria(): string
  136.     {
  137.         return $this->seria;
  138.     }
  139.     public function setSeria(string $seria): void
  140.     {
  141.         $this->seria $seria;
  142.     }
  143.     public function getNr(): ?string
  144.     {
  145.         return $this->nr;
  146.     }
  147.     public function setNr(?string $nr): void
  148.     {
  149.         $this->nr $nr;
  150.     }
  151.     public function getDataDin(): ?\DateTime
  152.     {
  153.         return $this->dataDin;
  154.     }
  155.     public function setDataDin(?\DateTime $dataDin): void
  156.     {
  157.         $this->dataDin $dataDin;
  158.     }
  159.     public function getCompany(): Company
  160.     {
  161.         return $this->company;
  162.     }
  163.     public function setCompany(Company $company): void
  164.     {
  165.         $this->company $company;
  166.     }
  167.     public function getContracTxt(): ?string
  168.     {
  169.         return $this->contracTxt;
  170.     }
  171.     public function setContracTxt(?string $contracTxt): void
  172.     {
  173.         $this->contracTxt $contracTxt;
  174.     }
  175.     public function getAnexa(): ?string
  176.     {
  177.         return $this->anexa;
  178.     }
  179.     public function setAnexa(?string $anexa): void
  180.     {
  181.         $this->anexa $anexa;
  182.     }
  183.     public function getStartDate(): ?\DateTime
  184.     {
  185.         return $this->startDate;
  186.     }
  187.     public function setStartDate(?\DateTime $startDate): void
  188.     {
  189.         $this->startDate $startDate;
  190.     }
  191.     public function getEndDate(): ?\DateTime
  192.     {
  193.         return $this->endDate;
  194.     }
  195.     public function setEndDate(?\DateTime $endDate): void
  196.     {
  197.         $this->endDate $endDate;
  198.     }
  199.     public function getTotalPaid(): ?float
  200.     {
  201.         return $this->totalPaid;
  202.     }
  203.     public function setTotalPaid(?float $totalPaid): void
  204.     {
  205.         $this->totalPaid $totalPaid;
  206.     }
  207.     public function getUnitPrice(): ?float
  208.     {
  209.         return $this->unitPrice;
  210.     }
  211.     public function setUnitPrice(?float $unitPrice): void
  212.     {
  213.         $this->unitPrice $unitPrice;
  214.     }
  215.     public function getIntervalOfUnitPrice(): ?float
  216.     {
  217.         return $this->intervalOfUnitPrice;
  218.     }
  219.     public function setIntervalOfUnitPrice(?float $intervalOfUnitPrice): void
  220.     {
  221.         $this->intervalOfUnitPrice $intervalOfUnitPrice;
  222.     }
  223.     public function getDurationMounth()
  224.     {
  225.         return $this->durationMounth;
  226.     }
  227.     public function setDurationMounth($durationMounth): void
  228.     {
  229.         $this->durationMounth $durationMounth;
  230.     }
  231.     /**
  232.      * @return Collection<int, Tranche>
  233.      */
  234.     public function getTranches(): Collection
  235.     {
  236.         return $this->tranches;
  237.     }
  238.     public function addTranch(Tranche $tranch): self
  239.     {
  240.         if (!$this->tranches->contains($tranch)) {
  241.             $this->tranches[] = $tranch;
  242.             $tranch->setContract($this);
  243.         }
  244.         return $this;
  245.     }
  246.     public function removeTranch(Tranche $tranch): self
  247.     {
  248.         if ($this->tranches->removeElement($tranch)) {
  249.             // set the owning side to null (unless already changed)
  250.             if ($tranch->getContract() === $this) {
  251.                 $tranch->setContract(null);
  252.             }
  253.         }
  254.         return $this;
  255.     }
  256.     public function getContractStatus(): ?ContractStatus
  257.     {
  258.         return $this->contractStatus;
  259.     }
  260.     public function setContractStatus(?ContractStatus $contractStatus): self
  261.     {
  262.         $this->contractStatus $contractStatus;
  263.         return $this;
  264.     }
  265.     public function getProject(): ?Project
  266.     {
  267.         return $this->project;
  268.     }
  269.     public function setProject(?Project $project): self
  270.     {
  271.         $this->project $project;
  272.         return $this;
  273.     }
  274.     public function isIndefinite(): ?bool
  275.     {
  276.         return $this->indefinite;
  277.     }
  278.     public function setIndefinite(bool $indefinite): self
  279.     {
  280.         $this->indefinite $indefinite;
  281.         return $this;
  282.     }
  283.     public function getCurrency()
  284.     {
  285.         return $this->currency;
  286.     }
  287.     public function setCurrency($currency): self
  288.     {
  289.         $this->currency $currency;
  290.         return $this;
  291.     }
  292.     public function getExchangeRate()
  293.     {
  294.         return $this->exchangeRate;
  295.     }
  296.     public function setExchangeRate($exchangeRate): self
  297.     {
  298.         $this->exchangeRate $exchangeRate;
  299.         return $this;
  300.     }
  301.     public function getHourlyRate():?float
  302.     {
  303.         return $this->hourlyRate;
  304.     }
  305.     public function setHourlyRate(?float $hourlyRate): self
  306.     {
  307.         $this->hourlyRate $hourlyRate;
  308.         return $this;
  309.     }
  310.     public function getContractedHour(): ?int
  311.     {
  312.         return $this->contractedHour;
  313.     }
  314.     public function setContractedHour(?int $contractedHour): self
  315.     {
  316.         $this->contractedHour $contractedHour;
  317.         return $this;
  318.     }
  319.     public function getContractParent(): ?self
  320.     {
  321.         return $this->contractParent;
  322.     }
  323.     public function setContractParent(?self $contractParent): self
  324.     {
  325.         $this->contractParent $contractParent;
  326.         return $this;
  327.     }
  328.     /**
  329.      * @return Collection<int, self>
  330.      */
  331.     public function getContracts(): Collection
  332.     {
  333.         return $this->contracts;
  334.     }
  335.     public function addContract(self $contract): self
  336.     {
  337.         if (!$this->contracts->contains($contract)) {
  338.             $this->contracts[] = $contract;
  339.             $contract->setContractParent($this);
  340.         }
  341.         return $this;
  342.     }
  343.     public function removeContract(self $contract): self
  344.     {
  345.         if ($this->contracts->removeElement($contract)) {
  346.             // set the owning side to null (unless already changed)
  347.             if ($contract->getContractParent() === $this) {
  348.                 $contract->setContractParent(null);
  349.             }
  350.         }
  351.         return $this;
  352.     }
  353.     public function getLanguage(): ?Language
  354.     {
  355.         return $this->language;
  356.     }
  357.     public function setLanguage(?Language $language): Contract
  358.     {
  359.         $this->language $language;
  360.         return $this;
  361.     }
  362.     public function getContractParentValue(): ?string
  363.     {
  364.         return $this->contractParentValue;
  365.     }
  366.     public function setContractParentValue(?string $contractParentValue): self
  367.     {
  368.         $this->contractParentValue $contractParentValue;
  369.         return $this;
  370.     }
  371. }